+ 1
What is happening in line 2 of this code ?
a = [[1,2], [2,3], [3,4]] b = [x for x in a for x in x] print(b) Output is [1,2,2,3,3,4]
1 Answer
+ 1
line 2 joins all 3 arrays in line 1 into 1 array
a = [[1,2], [2,3], [3,4]] b = [x for x in a for x in x] print(b) Output is [1,2,2,3,3,4]