This script checks whether a person is eligible for voting or not. Which variable is most appropriate for line 2?1 age=int(input("Enter your age"))2 if ___ >=18:3 print("_____ for voting")4 ____:5 print("not eligible for voting")agevotenameprint
Question
This script checks whether a person is eligible for voting or not. Which variable is most appropriate for line 2?1 age=int(input("Enter your age"))2 if ___ >=18:3 print("_____ for voting")4 ____:5 print("not eligible for voting")agevotenameprint
Solution 1
- age=int(input("Enter your age"))
- if age >= 18:
-
print("eligible for voting") - else:
-
print("not eligible for voting")
Solution 2
- age = int(input("Enter your age"))
- if age >= 18:
-
print("eligible for voting") - else:
-
print("not eligible for voting")
Solution 3
- age = int(input("Enter your age"))
- if age >= 18:
-
print("eligible for voting") - else:
-
print("not eligible for voting")
Similar Questions
Write a program to check whether a person is eligible for voting or not. (accept age from user)
Problem StatementBuild a program for a small town where individuals are eligible to vote only if they are 18 years or older. Take the age of a person as input and indicate their eligibility. If the age is 18 or above, print "Eligible for Voting"; otherwise, print "Not eligible for Voting" using the ternary operator.Input format :The input is an integer n, representing the age of the person.Output format :The output displays either "Eligible for Voting" or "Not eligible for Voting" based on age.Refer to the sample output for formatting specifications.Code constraints :In the given scenario, the test cases will fall under the following constraints:1 ≤ n ≤ 100Sample test cases :Input 1 :18Output 1 :Eligible for VotingInput 2 :37Output 2 :Eligible for VotingInput 3 :12Output 3 :Not eligible for VotingInput 4 :9Output 4 :Not eligible for Voting
Choose the code to assign your age into age variable?age=45print(age)age="45 "print(age)age=str(99)print(age)None of the above
entry is invalid, 1 if they are under the age limit or 2 if they are over the age limit. The function is shown below. The variables age and agelimit will both be integers.01 function checkage(age, agelimit):02 if age < 0 then03 return 004 elseif age < 38 then05 return 106 else:07 return 208 endif09 end functionThe code executes, but it does not give the correct result when called with: checkage(30, 20)The function returns 1, but it should return 2. State the type of error in the code and explain the change that needs to be made for the function to work.[3]
Program to check if a person can vote
Upgrade your grade with Knowee
Get personalized homework help. Review tough concepts in more detail, or go deeper into your topic by exploring other relevant questions.