+ 1

Boolean Logic: Output their age group

Boolean Logic Given the age of a person as input, you need to output their age group. Here are the age groups you need to handle: Child: 0 to 11 Teen: 12 to 17 Adult: 18 to 64 Senior: 65+ Sample Input 42 Sample Output Adult My code: age = int(input()) # your code goes here if age >= 0 and < 12: print("Child") elif age > 11 and < 18: print:("Teen") elif age > 17 and <65: print("Adult") elif age > 64: print("Senior") else: print("Invalid age") I keep getting Syntax error in the first line. Any advice would be appreciated!!

8th Aug 2021, 3:25 AM
Riley
15 Answers
+ 5
age = int(input()) if age <= 11: print("Child") elif( age >= 12 and age <= 18 ): print("Teen") else: print("Adult")
19th Dec 2021, 4:46 PM
باسط احمد
+ 1
age = int(input()) if age >= 0 and age < 12: print("Child") elif age >= 12 and age <= 18: print("Teen") else: print("Adult")
20th Dec 2021, 8:46 AM
Lema Kefyalew
Lema Kefyalew - avatar
+ 1
age=int(input()) if age>0 and age<=11: print( "Child") elif age>=12 and age<=17 : print ( "Teen") elif age>=18 and age<=64: print( "Adult") use it 100% work and all check point
30th Oct 2022, 8:05 AM
Abhishek Maheshwari
Abhishek Maheshwari - avatar
0
age=int(input('Enter the age: ')) if(age>=0 and age<=11): print('child') elif(age>=12 and age<=17): print('teen') elif(age>=18 and age<=64): print('adult') else: print('senior')
21st Dec 2021, 4:55 PM
SANVIKA
0
age = int(input()) if age >= 0 and age <=11: print("Child") elif age >= 12 and age <=17: print("Teen") elif age >= 18 and age <= 64: print("Adult") else: print("Senior")
8th Jan 2022, 1:49 PM
Ihor Princ
Ihor Princ - avatar
0
age=int(input()) # codes are here if age>=0 and age<=11 : print("Child") elif age>=12 and age<=17: print("Teen") elif age>=18 and age<=64: print("Adult") else: print("Invalid input")
29th Jan 2022, 2:27 PM
Souvik Pal
0
Try This! It works age = int(input()) # your code goes here if age>= 0 and age<=11: print("Child") elif age>=12 and age<=17: print("Teen") elif age >=18 and age<=64: print("Adult") elif age > 64: print("Senior")
31st Jan 2022, 11:18 AM
JAMESHA IBRAHIM K
JAMESHA IBRAHIM K - avatar
0
age = int(input()) if age > 0 and age < 12: print('Child') elif age > 11 and age < 18: print('Teen') elif(age>17 and age < 65): print('Adult') else: print("Senior")
15th Feb 2022, 2:33 PM
Alcino Castelo
0
/*Here it is your answer*/ age = int(input()) if (age >= 0 and age <= 11): print("Child") elif (age >=12 and age <= 17): print("Teen") elif (age >= 18 and age <= 64): print("Adult")
20th May 2022, 9:01 PM
Hamza Limam Eibba
Hamza Limam Eibba - avatar
0
I've tried like every code I can think of nothing works
4th Aug 2022, 2:07 AM
Godwin Coughan
Godwin Coughan - avatar
0
age = int(input()) if age <= 11: print("Child") elif (age >=12 and age <= 17): print("Teen") elif (age >=18 and age <= 64): print("Adult") else: print("Invalid input")
31st Aug 2022, 9:28 PM
Nidae El mouhib
Nidae El mouhib - avatar
0
age=int(input()) if age<11: print("Child") if(age >=12 and age<=18): print("Teen") else : print("Adult")
29th Sep 2022, 12:02 PM
Nagasiva Vakadani
Nagasiva Vakadani - avatar
1
Simba you are a legend and I am an idiot. I've spent 90 minutes on this. Thank you for your help!!!!
8th Aug 2021, 3:44 AM
Riley
2
try this it worked age = int(input()) if age <= 11: print('Child') elif age <= 18: print('Teen') else: print('Adult')
8th Jan 2022, 6:31 AM
Reyansh Gupta
5
Your conditions should be like this If age >= 0 and age < 12 and so on...
8th Aug 2021, 3:32 AM
Simba
Simba - avatar