where is the mistake I couldn't find it !!! the result is always the second message | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
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()

13th Oct 2017, 11:37 AM
Amine_Boyka
4 Answers
+ 1
Hello! Try this: age=int(input("enter your age"))
13th Oct 2017, 11:48 AM
Matteo Ballan
0
The else statment, there is a space between it and the colon, remove it. Other than I don't know.
13th Oct 2017, 11:46 AM
Anas Abdelkarim
Anas Abdelkarim - avatar
0
dont you get an error? Is it python2 or python3
13th Oct 2017, 11:59 AM
Oma Falk
Oma Falk - avatar
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
13th Oct 2017, 12:21 PM
LunarCoffee
LunarCoffee - avatar