Loading…
# Squares dictionary
squares = {x: x**2 for x in range(1, 6)}
{1: 1, 2: 4, 3: 9, 4: 16, 5: 25}
{key: value for item in iterable}
Create a dictionary where keys are numbers 1-5 and values are those numbers cubed (x³). Print it.
Downloading Python… (one-time, ~10 MB)
This runs entirely in your browser and is cached for next time.