Python for beginners practice question 22.2 | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Python for beginners practice question 22.2

I am working on this practice question currently and I’m trying to figure out where I have gone wrong. Below is what I have so far: age = int(input()) if age < 12 and age > 0: print ("child") elif age > 11 and age < 18: print ("Teen") elif age > 17 and age < 65: print ("Adult") else: print ("you're too old") #any insight would be appreciated!

11th Jan 2022, 12:36 AM
Zack Young
9 Answers
+ 9
11th Jan 2022, 2:08 AM
Simba - avatar
+ 1
I wrote it myself but it only passes 3 out of 5 test cases so I am not sure what it’s not happy with and The test cases I am not passing are locked
11th Jan 2022, 1:22 AM
Zack Young
+ 1
Here is the question should have included that in the post ha ha Given the age of a person as an input, 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 Sample Input 42 Sample Output Adult
11th Jan 2022, 1:32 AM
Zack Young
+ 1
That did it! Thanks a ton!
11th Jan 2022, 3:15 AM
Zack Young
+ 1
G'day Zack Young I've been using this technique when doing code coach: Highlight & copy the text from the question, eg: "Child" "Teen" "Adult" paste into your code (near the bottom), make a 👉print(" line for each output, then create my code above the outputs.... That way you are sure to get the correct text/capitalisation. Good luck mate!
11th Jan 2022, 10:02 AM
HungryTradie - avatar
i beleive teen starts at 13 and adult starts at 18
11th Jan 2022, 1:07 AM
Slick - avatar
seems ok so...i'm guessing that you didn't write it and just don't understand it..I'd recommend that you write it out in words..if you can't then review if statements
11th Jan 2022, 1:08 AM
Jamari McFarlane
Jamari McFarlane - avatar
The code is alright maybe I just didn't get the question right
12th Jan 2022, 9:58 AM
Paul Chirwa
Paul Chirwa - avatar
12th Jan 2022, 12:22 PM
Çılgın Ucube