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
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")
Quiz Coding
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
Define a variable called
answer
that gets the user's selected answer using theinput()
function. Then create anif
statement checking what the user entered, and then printing"True"
or"False"
.Example: