+ 2
How can I change tuples in a list to just a list?
How can I change [(2,3),(4,5)] to [2,3,4,5]?
4 Antworten
+ 5
a = [(2, 3), (4, 5)]
b = list(a[0]) + list(a[1])
or in a more generic way:
b = [ ]
for i in range(len(a)):
b += list(a[i])
+ 2
https://code.sololearn.com/c2GN3in0c8sm/?ref=app
+ 1
Thank you