Due Monday, October 10 at Midnight.
At the conclusion of this programming assignment, participants should be able to:
if
statementsBefore starting this programming assignment, participants should be able to:
Content used in this assignment is based upon information in the following sources:
Write an "are you a fan" quiz program (quiz.py). The program will quiz the user on a topic of your choosing (keep the topic appropriate!!). For quiz ideas, check out this website.
Note: Please cite all sources you use in your code.
Your quiz must contain 10 questions. These 10 questions include at least 2 of each of the following different types of questions:
The user enters in a character "a" through "e" for their answer.
Example:
1) What is the a rough estimate of the population of New York City? Please enter a character a-e.
a) 1 million
b) 3 million
c) 5 million
d) 8 million
e) 10 million
Note: The answer is d) 8 million!
The user enters in a numeric response to an open ended question. I recommend prompting the user to enter an integer. If you choose to use floats, be specific to the user about how they should enter their response (i.e. rounded and/or a certain number of decimal places).
Example:
How many states are there in the United States? Please enter an integer.
Note: The answer is 50!
The user enters 1 or 0 in response to a statement. Convert the string returned by input()
into an integer, and then into a Boolean with the bool()
type cast. Then compare the response to the reserved keywords True
or False
.
Example:
Alaska was the last state to enter the Union, true or false? Please enter 1 for True or 0 for False.
Note: The answer is False! Hawaii was the last state to enter the Union.
Additional requirements:
int
) if the user answered correctlyint
) if the user answered incorrectlyif-else
structure. If the user answers correctly, inform the user. Otherwise, provide the correct answer to the user.main()
function that drives your program. main()
should count the number of correct answers (this is the user's quiz score).if-elif-else
structure, which means you need at least 3 different fun statements based on the user's score).Here is a shortened example run of a quiz based on Game of Thrones. Credit for much of the content goes to these two online quizzes: Q1 and Q2.
Welcome to the Game of Thrones Quiz!!
1) Which Dire-wolf belonged to Robb? Please enter a character a-e.
a) Lady
b) Summer
c) Grey Wind
d) Nimeria
e) Ghost
b
Sorry, that is wrong. The answer is c) Grey Wind.
2) How many dragons does Daenerys own? Please enter an integer.
3
[output removed for brevity]
9) Name one of Daenerys' dragons. Please enter a string in all lower case.
drogon
10) Who wins the Kingsmoot on the iron isles? Please enter a character a-e.
a) Asha Greyjoy
b) Reek
c) Balon Greyjoy
d) Euron Greyjoy
e) Ramsay Bolton
d
You scored 9 questions correctly. Wow, you know your Game of Thrones!
<your last name>_pa3.zip
by the due date and time.This assignment is worth 75 points. Your assignment will be evaluated based on a successful compilation and adherence to the program requirements. We will grade according to the following criteria:
return
values to denote correct/incorrect answersmain()
function