In this assignment, you will write a program that accepts quiz questions/solutions, and then proceeds to give the quiz back to the user.
This program will begin by asking you (the user) for three question/solution pairs.
You should use the input()
function to prompt the user for these, and store them in variables.
Below is one example of the prompts, with example typed-inputs:
Enter question 1: What color is the sky?
What's the solution? blue
Enter question 3: How old is Donald Trump?
What's the solution? 71
Enter question 3: What is Beethoven's first name?
What's the solution? Ludwig
After you have read in these questions and solutions, you will begin giving the quiz “back” to the user. It will start with this notification:
----------
Let the quiz begin!
----------
Then, each question will be repeated back to the user. Immediately after each guess, the program will tell the user if they were right or wrong. For example:
What color is the sky? blue
Correct!
How old is Donald Trump? 65
Wrong
What is Beethoven's first name? Alex
Wrong
Finally, at the end of the quiz, the score will be shown as a percentage:
----------
You scored: 33%
----------
See a few examples of complete runs in the next section:
Enter question 1: What sport does Devin Booker play?
What's the solution? basketball
Enter question 3: What function reads input in python?
What's the solution? input()
Enter question 3: What year is it?
What's the solution? 2018
----------
Let the quiz begin!
----------
What sport does Devin Booker play? basketball
Correct!
What function reads input in python? input()
Correct!
What year is it? 2018
Correct!
----------
You scored: 100%
----------
Enter question 1: Which class is this?
What's the solution? 250
Enter question 3: What are the pre-reqs?
What's the solution? College Algebra
Enter question 3: What will we learn about?
What's the solution? Python
----------
Let the quiz begin!
----------
Which class is this? 250
Correct!
What are the pre-reqs? Math?
Wrong
What will we learn about? Python
Correct!
----------
You scored: 66%
----------
Name the file simple-quiz.py
.
All of your programs should be well-formatted and easy for the graders to read and comprehend. You should follow the style guidelines that we have discussed in class. Each program file should have a header comment at the top that has roughly the following format:
#
# Author: Student Name
# Description:
# A short description of what this program does!
#
This was assigned on January 19th, 2018. It is due on January 26th at 5:00pm.
Turn in each of the files described in the spec (1) to the assignment drop-box in D2L before the due date. Make sure to name the files exactly as this document specifies. In general, make sure to follow these instructions precisely.