-4

I have a list=[(1,10),(4,5),(2,7)] How to i separate the three paired elements into 6 unpaired ones?

  • Does this answer your question? [How to make a flat list out of a list of lists?](https://stackoverflow.com/questions/952914/how-to-make-a-flat-list-out-of-a-list-of-lists) – Mustafa Aydın Apr 12 '21 at 12:56

1 Answers1

0

You can simply use list comprehension:

# List of tuple initialization
lt = [(1,10), (4,5), (2,7)]
  
# get each element of each tuple
out = [item for t in lt for item in t]
  
# printing output
print(out)

The output is then:

[1, 10, 4, 5, 2, 7]

Source: this link and documentation linked above.

Maxouille
  • 2,729
  • 2
  • 19
  • 42