1. Clear Console (os.system('cls') or os.system('clear') if linux/mac.)
2. Display Quiz Menu.
3. Yields until the user gives some input to the console. (ex: Enter)
4. Initialize variable score = 0.
5. Read the questions.json file (Reads all questions).
6. Assign the file data to variable question_list.
7. Shuffle the question_list using the random module.
8. Create the total_questions variable by calculating the length of the
question_list.
9. Read the config.json file.
10. Assign the variables correct_response,
incorrect_response,
good_score_response, bad_score_response, good_score_requirement
based on the file data.
11. For each question in the question_list:
1. Clear Console
2. Display the question text and its possible answers.
3. Record the user_answer.
4. If the user_answer matches the correct_answer for that question:
• Increment score by 1.
• Display correct_response.
5. If the user_answer does not match the correct_answer for that
question:
• Display incorrect_response.
6. (Loop continues to next question)
12. After the loop is complete, calculate final_percentage = (score /
total_questions) * 100.
13. Determine which response to use by checking if final_percentage >=
good_score_requirement.
• If result is true then use good_score_response, otherwise
bad_score_response.
14. Clear Console and display the final score and final_percentage:.2f to
the user as well as the correct response type. (ex: “You answered score
out of total_questions correct and got a final_percentage:.2f%.
good_score_response).
15. Open the file quiz_results.txt.
16. Append the score, total_questions, and final_percentage:.2f to the
file as a new line.
1