#๐Ÿ”’ Help please

23 messages ยท Page 1 of 1 (latest)

azure spokeBOT
#

@restive turtle

Python help channel opened

Remember to:

  • Ask your Python question, not if you can ask or if there's an expert who can help.
  • Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
  • Explain what you expect to happen and what actually happens.

:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.

restive turtle
#

output I get sorry forgot to include

old needle
#

well, you'd need to print some spaces before you print any digits.

#

I don't get that output, at all

#
(echo 5; echo 0) | uv run python nikto.py 
Enter Number for Rows or 0 to quit: 111
111

1111


11111



Enter Number for Rows or 0 to quit: 
#

you probably didn't paste exactly the same code that you're running

frigid hill
#

print(' ' * number_of_spaces)

restive turtle
old needle
restive turtle
frigid hill
#

print(' ' * number_of_spaces, number)

old needle
#

try it and see

#

I can just paste what works for me, but I probably can't explain in detail how I did it -- I just poked at it instinctively until I got something working

restive turtle
#

Ill try to pick at your brain based off what you wrote. May I see

old needle
#

sure

#
def print_pyramid(rows: int) -> None:
    for i in range(1, rows + 1):
        print(" " * (rows - i), end="")

        for j in range(i, 0, -1):
            print(j, end="")

        for j in range(2, i + 1):
            print(j, end="")

        print()


def main() -> None:
    while True:
        num_rows = int(input("Enter number for Rows or 0 to quit: "))
        if num_rows == 0:
            break

        print_pyramid(num_rows)


main()
#
(echo 5; echo 0) | uv run python nikto.py 
Enter number for Rows or 0 to quit:     1
   212
  32123
 4321234
543212345
#

๐Ÿ‘ btw for using type hints

restive turtle
#

my guy @old needle I do understand I feel stupid for the lil extra i added. But in all thank you my guy ๐Ÿ™

#

Will see you soon you've helped me a lot lol so thank you sir

azure spokeBOT
#
Python help channel closed using Discord native close action

This help channel has been closed. Feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.