The index method of the tuple is incorrect

The result is 0? why? I think it should be 3

tupleTest = (1,5,‘gg’,True,‘kk’,False)
print(tupleTest.index(True))

tuple.index() finds the first element equal to to argument you provided.

>>> 1 == True
True

That’s because booleans are a subtype of integers.

>>> bool.mro()
[<class 'bool'>, <class 'int'>, <class 'object'>]
>>> True + 1
2
4 Likes
>>> 1 == True
True