Map dictionary values
Creates a dictionary with the same keys as the provided dictionary and values generated by running the provided function for each value.
- Use
dict.items()
to iterate over the dictionary, assigning the values produced byfn
to each key of a new dictionary.