Mindblown/loops2.py

10 lines
227 B
Python

l = [None] * 10
[_ for i,_ in enumerate(l) for l[i] in [i*5]]
print(l)
# and now with dicts, cause it works too
d = {i:i for i in range(10)}
[_ for i,_ in enumerate(d) for d[i] in [i*5]]
print(d)
# sadly sets won't let me :'(