Back to Lesson
Nested Dictionary Compression
Build profound data representations in tight spaces.
Instructions
- You have raw tuples corresponding to ID and coordinates:.
data = [(1, 0, 0), (2, 5, -2)] - Using a dictionary comprehension, assign the ID as the key.
- Assign a dictionary populated byas the value for the comprehension target!
{"x": <val1>, "y": <val2>} - Print the final assembled tree mapping.
main.py
main.py
Ctrl + Enter