Age Check

Write a program to determine if the user is an adult or not. The user should enter their age. If they are aged 21 or over the program should display “You are an adult”. If they are not, the program should display “You are not an adult”.

How old are you: 37
You are an adult
READ age FROM USER

IF age >= 21 THEN
    OUTPUT "You are an adult"
ELSE
    OUTPUT "You are not an adult"
END IF
age = int(input("How old are you: "))

if age >= 21:
    print("You are an adult")
else: 
    print("You are not an adult")
# Get age from the user
age = int(input("How old are you: "))

# Check if age is greater than or equal to 21
if age >= 21:
    # Display the 'You are an adult' message
    print("You are an adult")
# Else (if the user is younger than 21)
else: 
    # Display the 'You are not an adult' message
    print("You are not an adult")

Extension

Extend the program to check if the user is a teenager or a child.

How old are you: 25
You are an adult.
How old are you: 17
You are a teenager.
How old are you: 10
You are a child.

Target

You should be able to use If Statements to solve a problem.