Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Bad index in a sublist

In the following code

A=[[99999,99999,1,99999],[1,99999,1,99999]]
A[0].index(A[0][2])
A[0].index(A[0][0])
A[0].index(A[0][1])

The index returned is the true one if the value is encountered form the first time in the 0th element of A. So A[0].index(A[0][2]) and A[0].index(A[0][0]) give the good index. But not A[0].index(A[0][1]). Why ?