Articles

Voting eligibility program in python

Voting eligibility program in python


In this python programming article, we are going to learn

  • voting eligibility program in python

Voting eligibility program in python

The voting eligibility program in python is as follows:

 

# Owner : TutorialsInhand Author : Devjeet Roy

name = input("Enter your name: ").strip()
age = int(input("Enter your age: "))

if age >= 18:
    print("{} can cast votes this year!".format(name))
else:
    print("{} can cast votes after {} years!".format(name, 18-age))

The output of the voter program in python is as follows:

 

PS C:\Users\DEVJEET\Desktop\tutorialsInHand> python code.py
Enter your name: Devjeet
Enter your age: 22
Devjeet can cast votes this year!
PS C:\Users\DEVJEET\Desktop\tutorialsInHand> python code.py
Enter your name: Devjeet
Enter your age: 12
Devjeet can cast votes after 6 years!

Few important tips about this program

1. We take the name of the user and his/her age and we check voter eligibility.

2. A person in India is only allowed to votes only if his/her age is greater than or equal to 18 years.

 

Voting program in python snapshot is given below:

voting program in python

 


Basic Python Programs

Would you like to see your article here on tutorialsinhand. Join Write4Us program by tutorialsinhand.com

About the Author
Devjeet Roy
Full Stack Web Developer & Data Science Enthusiast
Page Views :    Published Date : Aug 01,2021  
Please Share this page

Related Articles

Like every other website we use cookies. By using our site you acknowledge that you have read and understand our Cookie Policy, Privacy Policy, and our Terms of Service. Learn more Got it!