Python: Input age and check qualification for voting

Python: if-else model: Here, we are executing a program, it will peruse age from the client and check whether an individual is qualified for voting or not.

Info age of the individual and check whether an individual is qualified for voting or not in Python.

This is a basic if-else model in the python – Here, we will peruse the age of the individual by utilizing input() capacity and convert the entered age an incentive to the number by utilizing int() work.

At that point we will check the condition, regardless of whether age is more prominent than or equivalent to 18 or not – if age is more noteworthy than or equivalent to 18, the individual will be qualified for the voting.

Program:

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

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

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

Output:

Enter Age : 20
You are  Eligible  for Vote.

Leave a Comment

error: Alert: Content is protected!!