0 of 464 solved
Write a function `generate_dictionary(n)` that builds a dictionary of square numbers from `1` through `n`.
Each key should be an integer from `1` to `n`, and each value should be the square of that key.
#### Example
Input: `8`
Output: `{1: 1, 2: 4, 3: 9, 4: 16, 5: 25, 6: 36, 7: 49, 8: 64}`def generate_dictionary(n):
"""
Generates a dictionary containing (i, i*i) pairs for each integral number between 1 and n (both inclusive).
Args:
n (int): The input number.
Returns:
dict: The generated dictionary.
"""
# TODO: Implement the generate_dictionary function
pass