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']
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']
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us