Objective
Create a Python program with a function whose most important test cases are at the boundaries of each interval: just before, right on and just after.
Instructions
- Define
classify_age(age), which returns:Invalidif the age is less than 0 or greater than 120;Childup to 12 years;Teenagerfrom 13 to 17;Adultfrom 18 to 64; andSeniorfrom 65 on. - Read an integer
nand thennages, one per line. - For each age, show
age: category.
4
-1
0
12
13
-1: Invalid
0: Child
12: Child
13: Teenager
Open the editor in full screen: the statement on the left and your code, the output and the tests on the right.
Start exercise