Last active
March 21, 2023 16:07
-
-
Save Columbo818/32057ee2a5b5cd730721aaf7fbfc2194 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Declare variables to hold points, questions, and answers. | |
points: int = 0 | |
name: str = input("What is your name?: ") | |
questions: str = ["How many staff work in the IT Support department?: ", | |
"How many displays are in the IT Support office?: ", | |
"How many CompSci Teachers work at KAA? (including cover): ", | |
"How many moves are required to solve a Rubik's cube?: ", | |
"On a scale of 1-10, how cool is Mr.Hibbeln?: " | |
] | |
quiz_answers: str = ["3", "7", "7", "20", "10"] | |
user_answers: str = ["", "", "", "", ""] | |
# Iterate over question and answer arrays, picking up questions and dropping off answers. | |
for q in range(len(questions)): | |
user_answers[q] = input(questions[q]) | |
# Check answer | |
if (user_answers[q] == quiz_answers[q]): | |
print("Correct! 👍") # Apply points for a correct answer | |
points += 5 | |
else: | |
print("Incorrect 👎") | |
if (points <= 10): # Check if points would go negative | |
print("No points left. Better luck next time! 😭") | |
points = 0 # Set points to 0 | |
break # Stop quiz | |
else: | |
points -= 10 # Remove points for an incorrect answer | |
print("Current score: ", points) # Report points after every question | |
print('Results for {} - {} points.'.format(name, points)) # Report score at the end of quiz |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment