Map list to dictionary
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 applyfnto each value of the list. - Use
zip()to pair original values to the values produced byfn. - Use
dict()to return an appropriate dictionary.