n=int(input("enter a number:"))
d=dict()
for i in range(1,n+1):
#print("i=",i)
d[i]=i*i
print(d)
output:
enter a number:5
{1: 1, 2: 4, 3: 9, 4: 16, 5: 25}
d=dict()
for i in range(1,n+1):
#print("i=",i)
d[i]=i*i
print(d)
output:
enter a number:5
{1: 1, 2: 4, 3: 9, 4: 16, 5: 25}
No comments:
Post a Comment