With a given integral number n, write a program to generate a dictionary that contains (i, i*i*i) such that is an integral number between 1 and n (both included). and then the program should print the dictionary.


Topic: With a given integral number n, write a program to generate a dictionary that contains (i, i*i*i) such that is an integral number between 1 and n (both included). and then the program should print the dictionary.

Solution

n = 8
d = dict()
for i in range(1,n+1):
    d[i] = i*i*i
print(d)



List all Python Programs