I have this list comprehension:
[[x,x] for x in range(3)]
which results in this list:
[[0, 0], [1, 1], [2, 2]]
but what I want is this list:
[0, 0, 1, 1, 2, 2]
What's the easiest to way to generate this list?
[y for x in range(3) for y in [x, x]]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With