Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

python generate dictionary in loop

n = int(input())
ans = {}
for i in range (1,n+1):
  ans[i] = i * i
print(ans)
Source by xahlee.info #
 
PREVIOUS NEXT
Tagged: #python #generate #dictionary #loop
ADD COMMENT
Topic
Name
5+5 =