Basic Programs

If Else Programs


Python Program To check if a Person's age is eligible for voting


In this example shows, how to check if a Person's age is eligible for voting.In India, the eligibility criteria for voting is set at 18 years and above, so we can use this condition to create the following program.

Steps
  1. Get Person's age from user Input
  2. Check if age is greater or equal to 18
  3. If Condition is true then print Eligible for Vote
  4. If Condition is false then print Not Eligible for Vote
example.py
age = int(input("Enter your Age : "))
if age>=18:
    print("Eligible for vote")
else:
    print("Not Eligible for vote")

Output 1

Enter your Age : 25
Eligible for vote

Output 2

Enter your Age : 17
Not Eligible for vote

Prev Next