Here's a meta one: build the tool that fights forgetting. A flashcard quiz checks what you remember by comparing your answer to the right one. You'll loop through a set of flashcards, score each answer, and print a final tally.
The questions and correct answers are stored in a dictionary. A list of answers (in the same order) simulates what a student typed, so the output is predictable and gradeable.
Your tasks
Given these starting values:
flashcards = {"Capital of France": "Paris", "2 + 2": "4", "Python list symbol": "[]"}
answers = ["Paris", "5", "[]"]
score = 0
1. Loop over the flashcards and the matching answer together. (Tip: zip(flashcards.items(), answers) pairs each (question, correct) with the student's given answer.)
2. If the given answer equals the correct answer, add 1 to score and print "{question}: correct".
3. Otherwise, print "{question}: wrong (answer: {correct})".
4. After the loop, print "Score: {score}/{len(flashcards)}".
Expected output
Capital of France: correct
2 + 2: wrong (answer: 4)
Python list symbol: correct
Score: 2/3
Constraints
- Loop over the dictionary with
.items()
- Use an
if / else to check each answer
- No external libraries