0

My pset6's mario-more Python implementation works fine. However, check50 is returns the following errors:

:( handles a height of 0 correctly / did not find EOF :( handles a height of 23 correctly / timed out while waiting for program to exit

I understand this is because the While loop never stops unless you input the right values. But isn't that supposed to be?

If not, should I setup a sort of timer, or try-count?

BTW, my code:

import cs50

def makePyramid(height):
    for i in range(1, height+1):
        print(" " * (height - i), end="")
        print("#" * i, end="")
        print(" " * 2, end="")
        print("#" * i)

# run program
while True:
    height = cs50.get_int("Height: ")
    if height > 0 and height < 23:
        makePyramid(height)
        break

Thanks!!

Daniel

1 Answer 1

1

0 and 23 are valid input values. By using >0 and <23 you exclude them. Use >= and <=.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .