how to extract the first elements from a list of tuples

Solutions on MaxInterview for how to extract the first elements from a list of tuples by the best coders in the world

showing results for - "how to extract the first elements from a list of tuples"
Frances
18 Feb 2020
1tuple_list = [("a", "b"),("c", "d")]
2first_tuple_elements = []
3
4for a_tuple in tuple_list:
5    first_tuple_elements.append(a_tuple[0])
6print(first_tuple_elements)
7
8#OUTPUT: ['a', 'c']