Skip to main content

i have trouble with the height value : 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 HeightHere is the error : 25
enter Height value between 1 and 23

       ~/workspace/pset6/ $ python mario.py 
Height: 25
enter Height value between 1 and 23

  ##
                   ###
                  ####
                etc.....

Here is the code import cs50

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

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), end=")
        # print newline
        print() 

if __name__ == '__main__':
    main()

if name == 'main': main()

i have trouble with the height value : 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

                    ##
                   ###
                  ####
                etc.....

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), end=")
    # print newline
    print()

if name == 'main': main()

i have trouble with the height value : 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 is the error :

~/workspace/pset6/ $ python mario.py 
Height: 25
enter Height value between 1 and 23

  ##
 ###
####
etc.....

Here is 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), end=")
        # print newline
        print() 

if __name__ == '__main__':
    main()
deleted 115 characters in body
Source Link
Genevie
  • 30
  • 1
  • 12

i have trouble with two things : 1- the pyramid those print the spaces and # correctly but there a line between each rows ? whyheight value ? 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 ##

                   ###
 ##
                  ####
 ###
                 #####
 ####
                ######etc.....

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), end=")
    # print newline
    print()

if name == 'main': main()

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()

i have trouble with the height value : 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

                    ##
                   ###
                  ####
                etc.....

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), end=")
    # print newline
    print()

if name == 'main': main()

Source Link
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()