What am I doing wrong? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

What am I doing wrong?

age = int(input()) if age >0 and <=11: print("Child") else If age >=12 and <=17: print ("Teen") else If age >=18 and <=65: print ("Adult")

31st Mar 2022, 4:51 PM
Faria 🐰
5 Answers
+ 5
Hi Faria! Actually, the above answer is correct. But, the problem is that he used else if instead of elif. It's the valid syntax for other languages but not for Python. Python syntax: if condition: print() elif condition: print() else: print()
31st Mar 2022, 5:23 PM
Python Learner
Python Learner - avatar
+ 4
You're not using loops in an appropriate way.
1st Apr 2022, 7:24 PM
Yusra
+ 3
You have to put the make the "i" in if command lowercase and you must put "age" after and age = int(input()) if age>0 and age<=11: print("Child") elif age>=12 and age<=17: print ("Teen") elif age>=18 and age<=65: print ("Adult") # Good Luck :)
31st Mar 2022, 5:03 PM
SoloProg
SoloProg - avatar
+ 2
^ It's saying invalid syntax
31st Mar 2022, 5:10 PM
Faria 🐰
+ 2
Oh I see. Thanks!!
31st Mar 2022, 6:42 PM
Faria 🐰