Boolean Logic: Output their age group | Sololearn: Learn to code for FREE!

+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!!

8/8/2021 3:25:14 AM

Riley

12 Answers

New Answer

+5

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

+1

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")

0

Simba you are a legend and I am an idiot. I've spent 90 minutes on this. Thank you for your help!!!!

0

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

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')

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")

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")

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")

0

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

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")

-2

Your conditions should be like this If age >= 0 and age < 12 and so on...

-2

try this it worked age = int(input()) if age <= 11: print('Child') elif age <= 18: print('Teen') else: print('Adult')