Activity 01
Coding Lab: List vs Dictionary Lookup
Students write functions to search 1000 random items by index in a list and by key in a dictionary. They use Python's time module to record execution times, run tests five times, and calculate averages. Groups plot results on shared graphs to visualize differences.
Why might a dictionary be more efficient than a list for specific search tasks?
Facilitation TipDuring the List vs Dictionary Lookup activity, guide students to run each test at least three times and average the results to account for system noise.
What to look forPresent students with two scenarios: 1) Storing a list of student names for alphabetical sorting, and 2) Storing user IDs and their corresponding email addresses. Ask students to identify the most appropriate data structure for each scenario and briefly explain why.