From Python docs:
list.index(x): Return the index in the list of the first item whose value is x. It is an error if there is no such item.
But, the following examples return these in the Python shell:
>>> [1, 2,True, 3, 'a', 4].index(True)
0
>>> [1, 2, 3, 'a', 4].index(True)
0
As you can see, it seems to be returning 0 even when True is not present in the list. This seems to be happening only when the parameter is True in list.index():
Does anyone know why?