Python index error value not in list...on .index(value)

Let's show some equivalent code that throws the same error.

a = [[1,2],[3,4]]
b = [[2,3],[4,5]]

# Works correctly, returns 0
a.index([1,2])

# Throws error because list does not contain it
b.index([1,2])

If all you need to know is whether something is contained in a list, use the keyword in like this.

if [1,2] in a:
    pass

Alternatively, if you need the exact position but don't know if the list contains it, you can catch the error so your program does not crash.

index = None

try:
    index = b.index([0,3])
except ValueError:
    print("List does not contain value")