In this python if else program, we will check whether a person is eligible to vote or not depending on his/her age.
Condition for eligibility:
If the age of a person is greater than 18 then the person is eligible otherwise not.
Steps to solve the program
- Take the age of the person as input through the user.
- If the age is greater than or equal to 18 then the person is eligible to vote, else the person is not eligible to vote.
- Use if-else statement for this purpose.
- Print the respective output.
age = int(input("Enter age: "))
if age >= 18:
print("You are eligible")
else:
print("You are not eligible")
Output :
Enter age: 20
You are eligible
Related Articles
Python program to check whether any given number is a palindrome.
Python program to check if any given string is palindrome or not.
Python program to check whether the given number is positive or not.
Python program to check whether the given number is negative or not.
Python program to check whether the given number is positive or negative and even or odd.