0

This is my first post on here are, I looked around but couldn't find the answer.

I am new to Python Coding about 2 weeks in, through school.

I am very unsure as to what is wrong with this. I'm trying to make it so if height is not between 5 and 100 then I goes to the else statement which links to the except block. if it is possible to make a VauleError to occur that is probably the easiest but not sure if that's possible.

anything and everything is appreciated thank you.

def dimensions():
    input_height = input("Hi bob, please enter the height of the box, in centimetres, that you will return the product in.")
    height = None

    while height is None:
        #input_height = input("Hi bob, please enter the height of the box, in centimetres, that you will return the product in.")
        
        try: 
            height = int(input_height)

            if 5 <= height <=100 : 
                print (height)
            

            else: 
                x= ("hello")
                print(int(x))

        except ValueError:
            input_height = input("{} is not a valid number, please enter a height that is inbetween 5cm and 100cm .".format(input_height))

dimensions()

0 Answers0