Back to Lesson
List-to-Dictionary Sequence
Generate key representations on the fly leveraging data iterators.
Instructions
- Given a raw list of strings.
words = ["apple", "bat", "car"] - Map each word to its string length dynamically.
- E.g.:... Use a dictionary comprehension over the list!
{"apple": 5, "bat": 3} - Print the result.
main.py
main.py
Ctrl + Enter