221k views
5 votes
write a program that asks the user to enter the persons age program should display whether the user is an infant or adult

User BStruthers
by
7.9k points

1 Answer

3 votes
# Get user input for age
age = int(input("Enter the person's age: "))

# Check if the person is an infant or an adult
if age < 1:
print("The person is an infant.")
elif age >= 1:
print("The person is an adult.")
else:
print("Invalid age input.")
User Janjonas
by
8.6k points