0

Boolean age group question: Why is this invalid syntax?

Im trying to do the Boolean age group challenge and it keeps saying line #9 is invalid syntax. What have I done wrong? age = int(input()) # your code goes here if age>0 and age<=11: print("Child") elif(age>=12 and age<=17): print("Teens") elif(age>=18 and age<=64): print("Adult") elif(age>64): print("Senior") https://code.sololearn.com/csoJUkN5cFQT/?ref=app

10th Aug 2021, 4:19 AM
Babydoll Scripts
Babydoll Scripts - avatar
4 Antworten
+ 5
If and elif statements have to be aligned vertically. if condition: print() elif condition: print()
10th Aug 2021, 4:32 AM
Simba
Simba - avatar
0
age = int(input()) # your code goes here if age>0 and age<=11: print("Child") elif(age>=12 and age<=17): print("Teens") elif(age>=18 and age<=64): print("Adult") elif(age>64): print("Senior")
13th Dec 2021, 3:46 PM
Chintala Santhosh
0
It is an indentation error
13th Dec 2021, 3:47 PM
Chintala Santhosh
0
This also works perfectly: age = int(input()) # your code goes here if age>=0 and age<=11: print("Child") if age>=12 and age<=17: print("Teen") if age>=18 and age<=64: print("Adult") if age>=65: print("Senior")
8th Mar 2022, 10:29 AM
Adigun Kazeem
Adigun Kazeem - avatar