-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy path3.3. Age Classifier.py
27 lines (27 loc) · 1 KB
/
3.3. Age Classifier.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
"""
3. Age Classifier
Write a program that asks the user to enter a person's age.
The program should display a message indicating whether the person is
an infant, a child, a teenager, or an adult. Following are the guidelines:
If the person is 1 year old or less, he or she is an infant.
If the person is older than 1 year, but younger than 13 years, he or she
is a child.
If the person is at least 13 years old, but less than 20 years old, he or she
is a teenager.
If the person is at least 20 years old, he or she is an adult.
Reference:
(1) Starting out with Python, Third Edition, Tony Gaddis Chapter 3
(2) https://youtu.be/XJRmzTvCvwA
"""
# Get User Input(a person's age)
# Convert User input to int
person_age = int(input("Please Enter Your age : "))
# check all the conditions
if person_age <= 1:
print("You are an infant")
elif person_age > 1 and person_age < 13:
print("You are a child")
elif person_age >= 13 and person_age < 20:
print("You are a teenager")
else:
print("You are an adult")