Quiz 8: Dictionaries, map/filter/reduce
This quiz will not cover sets or set operations. Those will be covered in a future quiz.
Learning Goals
map/filter/reduce
Students should be able to:
- use
mapin conjunction withlistandlambdato apply the mapping pattern to a list - understand how
mapworks with multiple lists - understand
zipand how it is related to map on mulitiple lists - use
filterin conjunction withlistandlambdato apply the filtering pattern to a list - understand how to translate between list comprehentsions and expressions that use
list,map,filter, andlambda. - use
reducein conjunction withlambdato express accumulation patterns - understand how to translate between accumuation loops and
reduceexpressions - understand the differece between calling
reducewith two arguments and three arguments.
Dictionaries
Students should be able to:
- Write literal dictionaries
- Write Python code to add, remove and overwrite key-value pairs
- Write code to iterate over dictionaries
- Write code to access dictionaries and appropriately choose the correct and efficient syntax for doing so
- Define ordered vs. unordered collections
- State what kinds of collection are ordered and unordered
- State that dictionaries are mutable
- Define key-value pair
- Design accumulation patterns using iteration and dictionaries
- Accumulate dictionaries using iteration
- Design an accumulation pattern using dictionaries to count and list data from another data structure such as a list
- Apply dictionaries to solve problems using real world data
- Correctly choose the appropriate data structure to solve a particular problem
Study Guide
- Study Guide #8 (Dictionaries, map/filter/reduce) [blank]
- Study Guide #8 (Dictionaries, map/filter/reduce) [Solutions]
Solutions
After your quiz is graded by instructors, you will get an email from Gradescope. Solutions for individual quiz questions are provided in the Gradescope rubric.