4 ms·
i didnt realize you could add the if statement in the comprehension where you did ['a' if i % 2 == 0 else 'b' for i in range(10)] very cool! I was only a
by misiti3780 12y ago
i didnt realize you could add the if statement in the comprehension where you did
['a' if i % 2 == 0 else 'b' for i in range(10)]
very cool!
I was only aware of code like
['a' for i in range(10) if i % 2 == 0]