+ 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]

28th Feb 2020, 3:59 AM
Peter Parker
Peter Parker - avatar
1 Resposta
+ 1
line 2 joins all 3 arrays in line 1 into 1 array
28th Feb 2020, 4:07 AM
BroFar
BroFar - avatar