Check Voting Eligibility

Check voting eligibility for a given age (18+).

Logic BuildingIntermediate
Logic Building
# Take age as input
age = int(input("Enter age: "))

# Check voting eligibility
if age >= 18:
    print("Eligible to vote")
else:
    print("Not eligible to vote")

Output

Enter age: 20
Eligible to vote

Enter age: 16
Not eligible to vote

Use >= operator to check if age is 18 or above.

Key Concepts:

  • Voting age is 18 or above
  • Use >= to include 18
  • Simple if-else structure