New submission from Chetan Palliwal <chetanjain1...@gmail.com>:

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 = {}".format(lm,po.index(lm)))
   ...:
value is = 11 and index is = 0
value is = 22 and index is = 1
value is = 33 and index is = 2
value is = 44 and index is = 3
value is = 11 and index is = 0
value is = 55 and index is = 5
value is = 66 and index is = 6
value is = 11 and index is = 0
value is = 88 and index is = 8

----------
components: Library (Lib)
messages: 378546
nosy: chetanpalliwal13
priority: normal
severity: normal
status: open
title: index function return first index for same element if repetitive in a 
list
type: behavior
versions: Python 3.6

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue42026>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to