Answers for "how to extract the first elements from a list of tuples"

0

how to extract the first elements from a list of tuples

tuple_list = [("a", "b"),("c", "d")]
first_tuple_elements = []

for a_tuple in tuple_list:
    first_tuple_elements.append(a_tuple[0])
print(first_tuple_elements)

#OUTPUT: ['a', 'c']
Posted by: Guest on April-30-2021

Code answers related to "how to extract the first elements from a list of tuples"

Code answers related to "TypeScript"

Browse Popular Code Answers by Language