0

I know this is simple, but for some reason I can't figure out how to create a while loop checking for inputs. Basically, how do i create a loop that asks for a value and if the value is less than whats required keep looping until it gets that value. For example My program requires a number greater than or equal to 7 but if a 6 is entered, It keeps prompting the user to enter the required value?

width = int(raw_input("How Long?"))

if width >= 7:
        width = input()
else:
    print('Has to be less than 7')
dabrams493
  • 61
  • 6

1 Answers1

0

This is what you are looking for:

width = int(raw_input("How Long?"))

while width <= 7:
    print "Min 7"
    width = int(raw_input())
Aswin Murugesh
  • 10,831
  • 10
  • 40
  • 69