Question: Write a function named create_squares_dictionary(n) which takes an integer as a parameter and creates a dictionary where the keys are the numbers between 1 and
Write a function named create_squares_dictionary(n) which takes an integer as a parameter and creates a dictionary where the keys are the numbers between 1 and n inclusive and the values are the squares of the keys.
For example:
| Test | Result |
|---|---|
a_dict = create_squares_dictionary(3) for key in sorted(a_dict): print(key, a_dict[key]) | 1 1 2 4 3 9 |
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
