Tell Me Your Age
- Create a program (<Date>_tell_me_your_age.py) that will do the following:
- Get input from shell “Tell me your age? “ and save whatever user enter into variable “age”. Remember all input from the python shell is a String. If you want to treat it as a number, you have to convert it to Integer using
age = int(age)
- If the user enters 0 print only “You are a newborn baby”.
- If the user enters any number smaller than 4 then print only “You are a toddler”.
- If the user enters any number smaller than 13 then print only “You are a kid”.
- If the user enters any number smaller than 20 then print only “You are a teenager”.
- If the user enters any number smaller than 40 then print only “You are an adult”.
- If the user enters any number greater than or equal to 40 then print only “Dude!! You are old.”.
- Get input from shell “Tell me your age? “ and save whatever user enter into variable “age”. Remember all input from the python shell is a String. If you want to treat it as a number, you have to convert it to Integer using
Example
Tell me your age? 0 You are a newborn baby
Tell me your age? 14 You are a teenager.
Tell me your age? 100 Dude!! You are old.
FOREVER LOOP
- After you are done with number 1, put the entire program inside a forever loop.
- As a bonus point, put a code inside the forever loop that if they enter “exit”, break from the loop.