Whilst I know what this piece of code does i have no clue how it achieves it. Can someone please explain it in the dumbest way?
vec = [[1,2,3], [4,5,6], [7,8,9]]
[num for elem in vec for num in elem]
[1, 2, 3, 4, 5, 6, 7, 8, 9]
The first for part of the code returns this:
[num for elem in vec]
[0, 0, 0]
Are they indexes for each nested lists first entry?
Thanks!