Update map_dictionary.md

This commit is contained in:
Isabelle Viktoria Maciohsek
2020-10-02 00:19:54 +03:00
committed by GitHub
parent 89941e0c55
commit 7b64e2ab99

View File

@ -5,9 +5,9 @@ tags: list,intermediate
Maps the values of a list to a dictionary using a function, where the key-value pairs consist of the original value as the key and the result of the function as the value. Maps the values of a list to a dictionary using a function, where the key-value pairs consist of the original value as the key and the result of the function as the value.
- Use `map` to apply `fn` to each value of the list. - Use `map()` to apply `fn` to each value of the list.
- Use `zip` to pair original values to the values produced by `fn`. - Use `zip()` to pair original values to the values produced by `fn`.
- Use `dict` to return a key value pair. - Use `dict()` to return an appropriate dictionary.
```py ```py
def map_dictionary(itr, fn): def map_dictionary(itr, fn):