+ 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!
9 Antworten
+ 9
print("Child")
+ 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
+ 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
+ 1
That did it! Thanks a ton!
+ 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!
0
i beleive teen starts at 13 and adult starts at 18
0
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
0
The code is alright maybe I just didn't get the question right
0
Print('Happy')