Skip to content
← Back to Community
Quiz Coding
Profile icon
KeshavNair

I am making code for a quiz. In the quiz, I want to make sure that when a user selects a certain answer, the program would display "true" or "false". How would I make this happen

Voters
Profile icon
EvelynnLeavitt
Profile icon
KeshavNair
Comments
hotnewtop
Profile icon
PYer

Define a variable called answer that gets the user's selected answer using the input() function. Then create an if statement checking what the user entered, and then printing "True" or "False".
Example:

print("What is Bill Gate's net worth?") answer = input("(USD): ") if answer.lower() == "9.7 billion": print("True") else: print("False")
Profile icon
zc670m

Write a program that can tell a person if they are eligible for benefits based on the following criteria: persons 55 and older qualify for (full benefits) if they earn no more than 45000. However, if they earn less than 75000 they get (partial benefits), and (no benefits) when their income is greater than 100000. Regardless of age, if income is less than 11000 they qualify for (full benefits). the output messages must match the phrases in the parentheses.

Profile icon
ArpanaSharma2

a=input(" ")
ans=""
if a==ans:
print(True)
else:
print(False)

Profile icon
doesthiswork

how do you do this in python

Profile icon
[deleted]

What language are you using?

Profile icon
KeshavNair

@ItsEmpCs
javascript