0
where is the mistake I couldn't find it !!! the result is always the second message
def main(): print("hello") age=input("enter your age") if age<=17: print("you are too young !") else : print("you are too old !") if __name__ == '__main__':main()
3 Réponses
+ 1
Hello!
Try this:
age=int(input("enter your age"))
0
dont you get an error?
Is it python2 or python3
0
Like Matteo is implying, you're not converting the input to an int. This means the input will be a string instead. Because the string isn't an int, it can't be compared properly to another int, like 17.
You should have put:
age = int(input("enter your age"))
instead. Happy coding! :D