How would you code for the following outcome?
tuple_list = [('a', 1), ('b', 3), ('c', 2), ...]
def flatten_tuple(tuple_list):
magic_happens here
return flat_list
flat_list = ['a', 1, 'b', 3, 'c', 2, ...]
It's a simple problem to solve this way:
def flatten_tuple(tuple_list):
flat_list = []
for a, b in tuple_list:
flat_list.append(a)
flat_list.append(b)
return flat_list
Am I missing something which can flatten the tuple list without iterating over the list itself?