+ 1
help me correct this simple code
hi this code is correct: x = 20 if x >= 20: print("You Win!") if x < 10: print ("you lose") but i cant use input: input ("what is your number?") x = input if x >= 20: print("You Win!") if x < 10: print ("you lose")
2 Answers
+ 10
You've almost got it right.
Just say
x =
int(input("what is your number?")) # corrected
if x >= 20:
print("You Win!")
if x < 10:
print ("you lose")
[edit: Schindlabua is right - it should be x =
int(input ("what is your number?")) to make your input an integer. Sorry for the confusion.]
+ 7
x = int(input("What is your number?"))
should do the trick. input() gives you a string, which you need to convert to a number first using int().