🐍 **Python Challenge: Create a Square Dictionary!**

:snake: Python Challenge: Create a Square Dictionary!

Use dictionary comprehension to create a dictionary of squares from 1 to 5. The expected output is {1: 1, 2: 4, 3: 9, 4: 16, 5: 25}. Join us and level up your Python game! :rocket: #PythonChallenge #DictionaryComprehension :books:

1 Like

d = {key: key**2 for key in range(1,6)}

print(d)

Output:

{1: 1, 2: 4, 3: 9, 4: 16, 5: 25}

1 Like