# Program: Quiz Scorer
# Developed independently by [Your Initials or ID]
# This code gets user answers, scores them, and gives feedback
# Questions and correct answers are stored in a list of dictionaries
questions = [
{"question": "What is the capital of France?", "answer": "Paris"},
{"question": "What is 5 + 7?", "answer": "12"},
{"question": "Which planet is known as the Red Planet?", "answer": "Mars"}
]
# Procedure that takes the list of questions and user responses, returns a score
def score_quiz(question_list):
score = 0
for q in question_list: # Iteration
user_answer = input(q["question"] + " ") # Input from user
if user_answer.strip().lower() == q["answer"].lower(): # Selection
score += 1
return score # Return final score
# Main program flow (sequencing)
print("Welcome to the quiz!")
final_score = score_quiz(questions) # Call to the procedure
print("You got", final_score, "out of", len(questions)) # Output to user
# Acknowledgments: No external code used. All code written by the student.