In this program, we use the built-in input function to ask the user for their age, and then convert the input to an integer using the int function. Next, we use an if statement to check if the user’s age is greater than or equal to 18. If it is, we print a message that the user can vote. Otherwise, we print a message saying the user is not yet old enough to vote.
# ask for the user’s age
age = int(input(“Enter your age: “))
# check if the user is old enough to vote
if age >= 18:
print(“You are eligible to vote.”)
print(“Sorry, you are not yet old enough to vote.”)