Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

python generate dictionary in loop

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