# input ageage=int(input("Enter Age : "))# condition to check voting eligibilityifage>=18: status="Eligible"else: status="Not Eligible"print("You are ",status," for Vote.") Output The output of the above program
Ternary Operator Program Code in Python # input ageage=int(input("Enter Age :"))# conditionstatus="Eligible"ifage>=18else"Not Eligible"# print messageprint("You are",status,"for Vote.") Output Enter Age :21 You are Eligible for Vote. ...
# Function to check if a person is eligible to vote def check_voting_eligibility(age): if age >= 18: print("You are eligible to vote.") else: print("You are not eligible to vote.") # Call the function with an age value check_voting_eligibility(16) Output: Explanation: Here, the...