Boolean Logic- Age Classifier | Sololearn: Learn to code for FREE!
Nouvelle formation ! Tous les codeurs devraient apprendre l'IA générative !
Essayez une leçon gratuite
+ 1

Boolean Logic- Age Classifier

I've done the basic and intermediate courses, and this should be correct, but I'm still getting an error. 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 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 >= 65: print("Senior") else: print("Invalid age") I pass 3/5 tests with this code, it fails when 12 is the input. 2, 19, 87 work, so I have no idea why this isn't working. I get a No Output for any number between 12 and 17.

13th Sep 2021, 4:07 PM
Kevin
3 Réponses
+ 3
There's an extra colon between print and ("Teen")
13th Sep 2021, 4:13 PM
Tim
Tim - avatar
+ 2
Omfg Nick, you're a genius. I love you, no homo.
13th Sep 2021, 4:15 PM
Kevin
+ 1
You're welcome ūüėČ
13th Sep 2021, 4:16 PM
Tim
Tim - avatar