2023-06-20 12:49:16 +00:00
|
|
|
l = [None] * 10
|
2023-06-20 16:07:26 +00:00
|
|
|
[_ for i,_ in enumerate(l) for l[i] in [i*5]]
|
2023-06-20 12:49:16 +00:00
|
|
|
print(l)
|
|
|
|
|
2023-06-20 12:50:14 +00:00
|
|
|
# and now with dicts, cause it works too
|
2023-06-20 12:49:16 +00:00
|
|
|
d = {i:i for i in range(10)}
|
|
|
|
[_ for i,_ in enumerate(d) for d[i] in [i*5]]
|
2023-06-20 12:50:14 +00:00
|
|
|
print(d)
|
|
|
|
|
|
|
|
# sadly sets won't let me :'(
|