Create a if statement program that will let the user enter his/her age and determine of the age is legal or not.
# Prompt the user to enter their age
age = int(input("Enter your age: "))
# Check if the age is legal
if age >= 18:
print("Your age is legal.")
else:
print("Your age is not legal.")
input()
function to get the user's input for their age. Since input()
returns a string, we convert it to an integer using int()
to perform the age comparison.