0

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]

  • Possible duplicate: https://stackoverflow.com/questions/1720421/how-do-i-concatenate-two-lists-in-python – yadejo Apr 17 '23 at 15:14

1 Answers1

0

Asterisks allow for the unpacking of iterables into a list/tuple

list = [A, *B, C] 

Will yield:

list = [1, 3, 4, 5, A]