programming-examples/python/Dictionary/Python script to generate and print a dictionary that contains a number (between 1 and n) in the form.py

8 lines
207 B
Python
Raw Normal View History

2019-11-15 12:59:38 +01:00
# Python script to generate and print a dictionary that contains a number (between 1 and n) in the form (x, x*x)
n=int(input())
d = dict()
for x in range(1,n+1):
d[x]=x*x
print(d)