Find the index of a tuple in a list of tuples in Python I'm a Python beginner.
I have the following array of unique tuples I'm playing with:
array = [(1, 2), (1, 7), (1, 5), (2, 5), (2, 7), (2, 9), (3, 4), (3, 5), (4, 5), (4, 7), (5, 8), (6, 7), (8, 9)]

I want to find the index of a given tuple (u, v) in this array. I wrote the following line which I believe can be improved, probably from removing the enumerate() to get simpler if conditions but can't figure it out...
Example for the tuple (6, 7) - Inputs are: 6 and 7
array = [(1, 2), (1, 7), (1, 5), (2, 5), (2, 7), (2, 9), (3, 4), (3, 5), (4, 5), (4, 7), (5, 8), (6, 7), (8, 9)]
# Inputs: 6 and 7
position = [i for i, tupl in enumerate(array) if (tupl[0] == 6 and tupl[1] == 7)]
print(position)
# Output: [11]
You're looking for the list.index function:
&gt;&gt;&gt; array = [(1, 2), (1, 7), (1, 5), (2, 5), (2, 7), (2, 9), (3, 4), (3, 5), (4, 5), (4, 7), (5, 8), (6, 7), (8, 9)]
&gt;&gt;&gt; array.index((6, 7))
11