Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

python if variable is greater than

while True:
    number = input("Pick a number 1-10: ")
    try:
        number = int(number)
    except ValueError:
        print(number, 'is not a number, try again.')
        continue
    if number < irand:
        print("    ")
        print("That's too high, try again.")
    elif number > irand:
        print("    ")
        print("That's too low, try again.")
    else:
        print("    ")
        print("You got it right! You won!")
        break
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #python #variable #greater
ADD COMMENT
Topic
Name
7+1 =