Define a function which can print a dictionary where the keys are numbers between 1 and 3 (both included) and the values are square of keys.


Topic: Define a function which can print a dictionary where the keys are numbers between 1 and 3 (both included) and the values are square of keys.

Solution

def print_dict_keys_val_1():
    d=dict()
    d[1]=1
    d[2]=2**2
    d[3]=3**2
    print(d)
        



List all Python Programs