'How can I Iterate through lists, without calling each list individually - in Python

I have the following arrays:

x=-1
y=1
a11 = [x,1]
a12 = [y,1]
a13 = [x,2]
a21 = [y,1]
a22 = [x,2]
a23 = [y,2]
a31 = [x,1]
a32 = [y,2]
a33 = [x,2]

And I need to run each array through the following if-else statement:

votes_1 = []
votes_2 = []
if a11[1] == 1:
  votes_1.append(a11[0])
else:
  votes_2.append(a11[0])

How can I do this without writing an if-else statement for each array? It's manageable for now, but I plan to have 25 of these arrays, and I feel like there's a better way.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source