```
list_1 = ['a', 'a', 'a', 'b']
list_2 = ['a', 'b', 'b', 'b', 'c']
```

so in the list above, only items in index 0 is the same while index 1 to 4 in both list are different. also, `list_2`

has an extra item `'c'`

.

I want to count the number of times the index in both list are different, In this case I should get 3.

I tried doing this:

```
x = 0
for i in max(len(list_1),len(list_2)):
if list_1[i]==list_2[i]:
continue
else:
x+=1
```

I am getting an error.

## Best Solution

Use the

`zip()`

function to pair up the lists, counting all the differences, then add the difference in length.`zip()`

will only iterate over the items that can be paired up, but there is little point in iterating over the remainder; youknowthose are all to be counted as different:The

`sum()`

sums up`True`

and`False`

values; this works because Python's`boolean`

type is a subclass of`int`

and`False`

equals`0`

,`True`

equals`1`

. Thus, for each differing pair of elements, the`True`

values produced by the`!=`

tests add up as`1`

s.Demo: