Activity 01
Pair Programming: Dictionary Builder
Pairs create a dictionary for a school library with books as keys and details as values. They add entries using assignment, retrieve with get(), and update prices. Finally, they print keys, values, and items to verify changes.
Differentiate between accessing a dictionary value using square brackets versus the .get() method.
Facilitation TipDuring Pair Programming: Dictionary Builder, pair stronger coders with peers who benefit from live explanation, so both partners speak the language of dictionaries as they build together.
What to look forProvide students with a pre-defined dictionary. Ask them to write one line of code to add a new entry, one line to change an existing entry's value, and one line to remove an entry. Collect these for review.