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
- Get Person's age from user Input
- Check if age is greater or equal to 18
- If Condition is true then print Eligible for Vote
- 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