question: ART AND LITERATURE: Who painted "The Birth of Venus"? a. Botticelli b. Michelangelo c. Leonardo da Vinci Enter your choice:d Invalid input! Enter a, b, or c next time. as a

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter5: Control Structures Ii (repetition)
Section: Chapter Questions
Problem 21PE
icon
Related questions
icon
Concept explainers
Question
I don’t know how to change my code to answer the question and make it just like the output
You notice that users are entering upper case letters, complete responses, and other hard to deal with input. To
help them out, you will extend your program so that if the user enters something other than 'a', 'b', or 'c' the
program will immediately respond with
Invalid input! Enter a, b, or c next time.
Your program will go on to mark them incorrect.
This behavior will apply to the multiple choice questions only. Below is how your output should look for the first
question:
ART AND LITERATURE: Who painted "The Birth of Venus"?
a. Botticelli
b. Michelangelo
c. Leonardo da Vinci
Enter your choice:d
Invalid input! Enter a, b, or c next time.
The correct answer was a
Transcribed Image Text:You notice that users are entering upper case letters, complete responses, and other hard to deal with input. To help them out, you will extend your program so that if the user enters something other than 'a', 'b', or 'c' the program will immediately respond with Invalid input! Enter a, b, or c next time. Your program will go on to mark them incorrect. This behavior will apply to the multiple choice questions only. Below is how your output should look for the first question: ART AND LITERATURE: Who painted "The Birth of Venus"? a. Botticelli b. Michelangelo c. Leonardo da Vinci Enter your choice:d Invalid input! Enter a, b, or c next time. The correct answer was a
#01:
print('ART AND LITERATURE: Who painted "The Birth of Venus"?')
print('a. Botticelli\nb. Michelangelo\nc. Leonardo da Vinci')
user_answer=input("Enter your choice:")
if user_answer=='a':
print("Correct!")
score+=1
else:
#02:
print('ENTERTAINMENT: How many oscars did Alfred Hitchcock win?')
print('a. None\nb. One\nc. Two')
user_answer=input("Enter your choice:")
if user_answer=='a':
print("Correct!")
#03:
print("The correct answer was a"):
score+=1
elif user_answer!='a' or user_answer!= 'b' or user_answer!='c':
print("Invalid input! Enter a, b, or c next time.")
else:
print("The correct answer was a")
print('GEOGRAPHY: Which is the largest ocean?')
print('a. Pacific\nb. Atlantic\nc. Indian')
user_answer=input("Enter your choice: ")
if user_answer== 'a':
print("Correct!")
# 04:
score+=1
elif user_answer!='a' or user_answer!='b' or user_answer!='c':
print("Invalid input! Enter a, b, or c next time.")
else:
print("The correct answer was a")
print('HISTORY: Who was the first U.S. president to appear on a coin?')
print('a. Washington\nb. Lincoln\nc. Jefferson')
user_answer=input("Enter your choice:")
if user_answer== 'b':
print("Correct!")
elif user_answer!= 'a' or user_answer!='b' or user_answer!='c':
print("Invalid input! Enter a, b, or c next time.")
else:
print("The correct answer was b")
#05:
score+=1
print('SCIENCE AND NATURE: Can pigs swim?')
print('a. Yes\nb. No\nc. Only in salt water')
user_answer=input("Enter your choice:")
if user_answer=='a':
print("Correct!")
#06
score+=1
elif user_answer!='a' or user_answer!='b' or user_answer!='c':
print("Invalid input! Enter a, b, or c next time.")
else:
print("The correct answer was a")
nrint('SPORT AND LETSURE: What color is the middle Olymnic ring?!)
MacE
Transcribed Image Text:#01: print('ART AND LITERATURE: Who painted "The Birth of Venus"?') print('a. Botticelli\nb. Michelangelo\nc. Leonardo da Vinci') user_answer=input("Enter your choice:") if user_answer=='a': print("Correct!") score+=1 else: #02: print('ENTERTAINMENT: How many oscars did Alfred Hitchcock win?') print('a. None\nb. One\nc. Two') user_answer=input("Enter your choice:") if user_answer=='a': print("Correct!") #03: print("The correct answer was a"): score+=1 elif user_answer!='a' or user_answer!= 'b' or user_answer!='c': print("Invalid input! Enter a, b, or c next time.") else: print("The correct answer was a") print('GEOGRAPHY: Which is the largest ocean?') print('a. Pacific\nb. Atlantic\nc. Indian') user_answer=input("Enter your choice: ") if user_answer== 'a': print("Correct!") # 04: score+=1 elif user_answer!='a' or user_answer!='b' or user_answer!='c': print("Invalid input! Enter a, b, or c next time.") else: print("The correct answer was a") print('HISTORY: Who was the first U.S. president to appear on a coin?') print('a. Washington\nb. Lincoln\nc. Jefferson') user_answer=input("Enter your choice:") if user_answer== 'b': print("Correct!") elif user_answer!= 'a' or user_answer!='b' or user_answer!='c': print("Invalid input! Enter a, b, or c next time.") else: print("The correct answer was b") #05: score+=1 print('SCIENCE AND NATURE: Can pigs swim?') print('a. Yes\nb. No\nc. Only in salt water') user_answer=input("Enter your choice:") if user_answer=='a': print("Correct!") #06 score+=1 elif user_answer!='a' or user_answer!='b' or user_answer!='c': print("Invalid input! Enter a, b, or c next time.") else: print("The correct answer was a") nrint('SPORT AND LETSURE: What color is the middle Olymnic ring?!) MacE
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Follow-up Questions
Read through expert solutions to related follow-up questions below.
Follow-up Question

is there another way to do it without using ins.islower?

Solution
Bartleby Expert
SEE SOLUTION
Knowledge Booster
Operators
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning