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 don't need for loop **IF** you have **only one** tuple to check . Just directly check using `if`

```
tpl = (4,5) # Single user defined tuple
if tpl in list1:
    print ("OK")

```

If you have **many** tuples to check

```
tuplst = [(3,4), (1,2)] # List of tuples
list1 = [(3, 4), (4, 5), (5, 6)]

for tpl in tuplst:
    if tpl in list1:
        print ("OK")

```

The problem in your code was that when you do `list1[item]`, you are trying to do `list1[(3, 4)]` which is not the correct way to index a list and hence you get the `IndexError`
An alternative solution:

```
for i in list1:
    if i==(4,5):
        print("Ok")
    else:
        ....

```