Python Quiz With Dictionary
Quiz on the APCSP Python Lesson But Different
Q_Bank = {
"Dynamic code is code that has inputs and outputs that can change?":"true",
"What is the keyword for defining a function in Python?": "def",
"In Jupyter Notebooks the Input is in line with the Output": "false",
"What is grouping often used commands called?": "procedural abstraction",
}
score = 0
for Q, ans in Q_Bank.items():
print(Q)
rsp = input(Q)
if rsp.lower().strip() == ans.lower().strip():
print(f"Your answer {rsp} is the correct correct")
score += 1
else:
print(f"Your answer {rsp} doesn't equal the correct answer/s which is {ans}")
print(f"Your score is {score} out of {len(Q_Bank)} points.")