104k views
1 vote
Prompt the user with: "Is the answer the user reported true? Enter a Boolean value." Store the value in the variable called "answer". Let the user know if the value in the variable "answer" is true by printing an appropriate message to the console. Starting with the "if" statement you built in the previous problem, add an "else" clause to it so that if the answer was false, your program will output "The value was false" instead.

User Edhgoose
by
6.7k points

1 Answer

3 votes

Answer:

answer=input("Is the answer the user reported true?\\True or False") #prompt the user to enter a boolean value

if answer == True: #if condition to check weather the value in variable answer is true or false

print("The value was True")

else: #else condition to check weather the value in variable answer is False

print("The value was False")

Step-by-step explanation:

the code is in python programming language.

we use print comand to promt the user, or to display a message on the console.

we use if-else condition to check any statement or variable.

to take input from the user we use input command and store that input in any variable.

we have used equals(==) operator to match the variable with our required condition.

User Rich Sutton
by
6.9k points