due: Tue, November 18, 8pm
Review the class notes for this week.
Please note: We have a reading to prepare for discussion this week. Check the schedule page (under week 13).
(Update: Focus on parts 1 & 3, and consider part 2 as optional.) Modify your guessing game from last week to add a "high score list"? When the game ends, attempt to load a JSON file with a high score data structure, or if it does not exist, create one. Add the user's name and score (number of guesses) to the data structure and print it. Then save the modified score list to a JSON file.
import json, then
uses open() to read the contents of a file, then
uses json.loads() to interpret the contents of that
file as a JSON string, and then finally uses
a while loop to iterate over the data structure
that comes from loading the JSON string.
As an example, you can also consider referencing the Week 6 homework that added a new item to a "herd of creatures" every time the user pressed a key.