How does items() hand you both halves of an entry at once, and why does = alias a dictionary where .copy() does not?
Short drills on what this video just taught. Write the code, run the checks, and reveal the answer only if you are stuck.
grades maps four students to their letter grades. Ask the dictionary for its values, turn what comes back into an ordinary list, and assign that list to value_list, keeping the entries in the order they were inserted.
(Hint: the object handed back prints in an unfamiliar way — list() converts any iterable into a list.)
What the three dictionary methods return
Record that grades.keys(), grades.values() and grades.items() mutate nothing and return iterables of type dict_keys, dict_values and dict_items, each castable to a list with list(...).
Unpacking an entry with for k, v in d.items()
Write count_matches both ways, once over d.items() testing k == v and once over d.keys() testing d[x] == x, and run both on {1: 2, 'a': 'a', 5: 5} to get 2.
Aliasing versus .copy()
State that d2 = d1 leaves both names on one dictionary so mutating either shows in both, while d3 = d1.copy() produces an independent object.
Restrictions on keys, freedom of values
Record that a dictionary value may be any object at all and that keys must be unique, listing int, float, str, tuple and bool as usable keys and list and dict as not.