Kalebu Jordan

Become a Pro Python Developer

On this tutorial We will build a Simple Python Program to check If you’re eligible or not eligible to vote based on on age factor

We are going to check whether a person age is above or below 18 , If the the person age is below he/she is not eligible to vote and vice verse

Program Instructions summary

  • Getting user’s age
  • Checking If user’s age is below or above 18
  • If age is below 18 he/she is not eligible and vice verse

voting.py

#Getting user's age
age = int(input('Enter your age : '))

#Checking if age is below 18 
if age<18:
    print('you\'re not eligible to vote')
else:
    print('you\'re eligible to vote')

Running our Program

kalebu@kalebu-PC:~$ python3 vote.py 
Enter your age : 19
you're eligible to vote
---------------------------------
kalebu@kalebu-PC:~$ python3 vote.py 
Enter your age : 16
you're not eligible to vote

Hope you find this post interesting , don’t forget to subscribe to get more tutorials like this

In case of any suggestion or comment , drop it on the comment box and I will reply to you immediately.

Leave a Reply

error

Enjoy this blog? Please spread the word :)