Question: I have a list of tuples. I want to pick each and every tuple in the list and compare it with another tuple which is defined by me. 

The code that i used is as follows;

```
list1 = [(3, 4), (4, 5), (5, 6)]
for item in list1:
   if list1[item] == (4,5)
      print ("OK")

```

but it says that list indices must be an integer or slice. If i want to take each tuple in the list and compare them against another, how should i code it?

please help me!

Answer: 
you could just test if the tuple (`(4, 5)` in the example below) is in the list:

```
if (4, 5) in list1:
    print('OK')

```

there is no need for an explicit loop.

if you have multiple tuples to check against, i suggest you use [`set`](https://docs.python.org/3/library/stdtypes.html?highlight=set#set)s:

```
cmp = set(((4, 5), (5, 6)))
if cmp < set(list1):
    print('OK')

```

this checks if *both* tuples appear at least once in your original list.
you can achieve it the following way.. 

```
list1 = [(3, 4), (4, 5), (5, 6)]
for item in range(len(list1)):
    if list1[item] == (4,5):
        print ("OK")
    else:
        continue

```