0
Please some one explain this what iterator is j
smart_multiples = {i: [j for j in range(20) if not j % i] for i in range(2, 10)} print(smart_multiples
2 Respuestas
+ 2
That's a comprehension creating an iterable.
You might wanna read this:
https://code.sololearn.com/ck6HicJ6Z8jG/?ref=app
0
Nidified comprehension, to be exact.
The outer one {} is a dictionary comprehension, which generates 8 couples key -> list of multiples of the key. The 8 list of multiples are generated by 8 list comprehensions []