In: Computer Science
Complete the following in syntactically correct Python code.
1. The program should display a message indicating whether the person is an infant, a child, a teenager, or an adult.
Following are the guidelines:
a. If the person is older than 1 year old or less, he or she is an infant.
b. If the person is older than 1 year, but younger than 13, he or she is a child
c. If the person is at least 13 years old, but less than 20 years old, he or she is a teenager.
d. If the person is at least 20 years old, he or she is an adult.
Code:
def main():
# Take Input the person's age and typecast it to int
age = int(input('Enter your age: '))
# If infant
if age <= 1:
print('You\'re an infant.\n')
# If child
elif age>1 and age<13:
print('You\'re a child.\n')
# If teenager
elif age>=13 and age<20:
print('You\'re a teenager.\n')
else:
print('You\'re an adult.\n')
if __name__ == '__main__':
main()
Screenshots:
Output:
-------------------------END---------------------
Please give a thumbs up(upvote) if you liked the answer.