[issue42026] index function return first index for same element if repetitive in a list

2020-10-19 Thread Chetan Palliwal
Chetan Palliwal added the comment: If the index() is working fine. why my previous attached code sample is returning 0 for each time I try to get the index for element 11 in the list. -- ___ Python tracker <https://bugs.python.org/issue42

[issue42026] index function return first index for same element if repetitive in a list

2020-10-19 Thread Chetan Palliwal
Chetan Palliwal added the comment: can you let it work using the index method then it index() is working fine. I can resolve it by using enumerate and another way. The issue I raised here for the index() method not for enumerate. -- status: closed -> o

[issue42026] index function return first index for same element if repetitive in a list

2020-10-13 Thread Chetan Palliwal
Chetan Palliwal added the comment: if an element in the list present more than 1 times in different order and we try to get the index of it python 3.6 is returning only the first index value for all places of that element in that list. -- Added file: https://bugs.python.org

[issue42026] index function return first index for same element if repetitive in a list

2020-10-13 Thread Chetan Palliwal
New submission from Chetan Palliwal : In [1]: po=[11,22,33,44,11,55,66,11,88] In [2]: for lm in po: ...: if lm==11: ...: print("value is = {} and index is = {}".format(lm,po.index(lm))) ...: else: ...: print("value is = {} and index is