Skip to main content
1 of 3
Genevie
  • 30
  • 1
  • 12

mario pset6 PYTHON

i have trouble with two things : 1- the pyramid those print the spaces and # correctly but there a line between each rows ? why ? 2- when i enter Height of 1 or 25 (where Height must be higher than 1 and not higner than 23), it does print the error message but it also print the pyramid. What i am doing wrong, that the break doesn't work ? tks
Here the error : ~/workspace/pset6/ $ python mario.py Height: 25 enter Height value between 1 and 23 ##

                   ###

                  ####

                 #####

                ######

Here the code import cs50

def main(): print("Height: ", end="") Height = cs50.get_int()

while True:
    if Height > 1 or Height < 23:
        print("enter Height value between 1 and 23")
    break



for i in range (Height):
    print(" "*(Height-i-1), end="")
    print("#"*(i+2))
    # print newline
    print()

if name == 'main': main()

Genevie
  • 30
  • 1
  • 12