Back
Can someone help me rewrite the single line loop to multiple the lines using for loop in python? I am trying to understand how this has formatted.
y = {element: r for element in variables(e)}
The dictionary comprehension is equivalent to the below loop:
y = {}for element in variables(e): y[element] = r
y = {}
for element in variables(e):
y[element] = r
Want to be a master in Data Science? Enroll in this Data Scientist
31k questions
32.8k answers
501 comments
693 users