Write a wholly creative quiz program that consists of three original questions that you make up according to these specifications: One question should require user input of type int One question should require user input of type float One should require a string input The quiz should be scored by using a counter variable that has an initial value of zero and is incremented by one for every correct answer. Provide feedback to the user for each question, and report the total score when the quiz has finished. Example runs not shown. It's a creative exercise.   def main():points = 0states = int(input('How many states in the USA? '))if states == 50:points +=1print('Correct. Good job!')else:print('Sorry, the answer is 50') points = 0capital = input('What is the capital of England? ')if capital == "London":points+=1print('Correct. Well done.')else:print('Sorry, the answer is London .') points = 0points = float(input('How many points does a pentagram have? '))if points == 10:points +=1print('Excellent.')else:print('Sorry, the answer is 10') main() My code. How do I display the total score for quiz?

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 28PE
icon
Related questions
icon
Concept explainers
Question
100%

Write a wholly creative quiz program that consists of three original questions that you make up according to these specifications:

  • One question should require user input of type int
  • One question should require user input of type float
  • One should require a string input

The quiz should be scored by using a counter variable that has an initial value of zero and is incremented by one for every correct answer. Provide feedback to the user for each question, and report the total score when the quiz has finished. Example runs not shown. It's a creative exercise.

 

def main():
points = 0
states = int(input('How many states in the USA? '))
if states == 50:
points +=1
print('Correct. Good job!')
else:
print('Sorry, the answer is 50')

points = 0
capital = input('What is the capital of England? ')
if capital == "London":
points+=1
print('Correct. Well done.')
else:
print('Sorry, the answer is London .')

points = 0
points = float(input('How many points does a pentagram have? '))
if points == 10:
points +=1
print('Excellent.')
else:
print('Sorry, the answer is 10')


main()

My code. How do I display the total score for quiz?

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 2 images

Blurred answer
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
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage
Programming with Microsoft Visual Basic 2017
Programming with Microsoft Visual Basic 2017
Computer Science
ISBN:
9781337102124
Author:
Diane Zak
Publisher:
Cengage Learning