Python Program to check Person is Eligible for Voting or Not

Python Program to check Person is Eligible for Voting or Not 


age=int(input("Enter age of person:"))

if age>=18:

    print(f"The age of person is {age} and eligible for voting:")

else:

    print(f"The age of person is {age} and is not eligible for voting")

print("End of program")

Output:

Enter age of person:17

The age of person is 17 and is not eligible for voting

End of program


Another Program

name=str(input("Enter name of person:"))

age=float(input("Enter age of person:"))

if age>=18:

    print(f"{name} is eligible for voting")

else:

    print(f"{name}s age is {age} and  is not eligible for voting")

print("End of program")


Output:

Enter name of person:Rohan

Enter age of person:19

Rohan is eligible for voting

End of program

टिप्पणी पोस्ट करा

0 टिप्पण्या