Home » Python programs

Python | Input age and check eligibility for voting

Python | if else example: Here, we are implementing a program, it will read age from the user and check whether person is eligible for voting or not.
Submitted by Pankaj Singh, on September 29, 2018

Input age of the person and check whether a person is eligible for voting or not in Python.

This is a simple if else example in the python - Here, we will read the age of the person by using input() function and convert the entered age value to the integer by using int() function. Then we will check the condition, whether age is greater than or equal to 18 or not - if age is greater than or equal to 18, the person will be eligible for the voting.


# input age
age = int(input("Enter Age : "))

# condition to check voting eligibility
if age>=18:
    status="Not Eligible"

print("You are ",status," for Vote.")


Enter Age : 19
You are  Eligible  for Vote.

Comments and Discussions

Ad: Are you a blogger? Join our Blogging forum.

Languages: » C » C++ » C++ STL » Java » Data Structure » C#.Net » Android » Kotlin » SQL
Web Technologies: » PHP » Python » JavaScript » CSS » Ajax » Node.js » Web programming/HTML
Solved programs: » C » C++ » DS » Java » C#
Aptitude que. & ans.: » C » C++ » Java » DBMS
Interview que. & ans.: » C » Embedded C » Java » SEO » HR
CS Subjects: » CS Basics » O.S. » Networks » DBMS » Embedded Systems » Cloud Computing » Machine learning » CS Organizations » Linux » DOS
More: » Articles » Puzzles » News/Updates

© https://www.includehelp.com some rights reserved.