Looking to flatten a 2D list into a 1D list without for loops
or other packages...
A = 1
B = [3, 4, 5]
C = A
list = [A, B, C]
shown: list = [1, [3, 4, 5], A]
This is what's desired
Desired: list = [1, 3, 4, 5, A]
Looking to flatten a 2D list into a 1D list without for loops
or other packages...
A = 1
B = [3, 4, 5]
C = A
list = [A, B, C]
shown: list = [1, [3, 4, 5], A]
This is what's desired
Desired: list = [1, 3, 4, 5, A]
Asterisks allow for the unpacking of iterables into a list/tuple
list = [A, *B, C]
Will yield:
list = [1, 3, 4, 5, A]