i need help working on a list: i have a list like this
[[1, 2, 3, 5], [3, 4, 5, 6], [7, 8, 9, 3],[10, 11, 12, 13]]
how do I get the first element of all the list within the list.
desired output:
1
3
7
10
i need help working on a list: i have a list like this
[[1, 2, 3, 5], [3, 4, 5, 6], [7, 8, 9, 3],[10, 11, 12, 13]]
how do I get the first element of all the list within the list.
desired output:
1
3
7
10
You just iterate as it were a flat list
lists = [[1, 2, 3, 5], [3, 4, 5, 6], [7, 8, 9, 3],[10, 11, 12, 13]]
for l in lists:
if l != []:
print(l[0])