Saturday 14 September 2024

Practical - 61 - Write a program in python that takes age as input from the user and if age is greater than or equal 18 then print “YOU CAN VOTE” otherwise print “YOU CAN NOT VOTE”.

Practical - 61 - Write a program in python that takes age as input from the user and if age is greater than or equal 18 then print “YOU CAN VOTE” otherwise print “YOU CAN NOT VOTE”.


Ans:

age=int(input("Enter your age: "))

if age>=18:

    print("YOU CAN VOTE")

else:

    print("YOU CAN NOT VOTE")

 

Output:

Enter your age: 21

YOU CAN VOTE

OR

Enter your age: 17

YOU CAN NOT VOTE

No comments:

Post a Comment