Write a program to check whether a person is eligible for voting or not. (accept age from user)
Question
Write a program to check whether a person is eligible for voting or not.
- Accept age from user.
Solution
Sure, here is a simple Python program that checks if a person is eligible to vote based on their age:
# Step 1: Get the age from the user
age = int(input("Please enter your age: "))
# Step 2: Check if the age is greater than or equal to 18
if age >= 18:
print("You are eligible to vote.")
else:
print("You are not eligible to vote.")
This program works by first asking the user to input their age. It then checks if the age is 18 or more. If it is, it prints a message saying the user is eligible to vote. If it's not, it prints a message saying the user is not eligible to vote.
Similar Questions
Write the output of the program below. age = 45if (age >= 35): {print ("I am Qualified")}
How old do citizens have to be to vote for President?*18 years21 years25 years16 years
list out in detail functional and non functional reuirements of online voting system
Write an essay about, Restrictions should be placed on the age at which politicians can serve as government ministers?
What is the minimum age required for one to be elected as a Member of Parliament in Ghana? A. 18 B. 21 C. 25 D. 30
Upgrade your grade with Knowee
Get personalized homework help. Review tough concepts in more detail, or go deeper into your topic by exploring other relevant questions.