# Revision history [back]

### Index without multiplicities

I want really the vector zz. Unfortunatelly as 5 is present with multiplicity 2 the only index for 5 is 0. I want also 2. How to obtain the desired return ?

So

z=[5,0,5,0,10,13,14,]
zz=[(z.index(v),v) for v in z if v!=0]
show(zz)


returns [(0, 5), (0, 5), (4, 10), (5, 13), (6, 14)] when I want [(0, 5), (2, 5), (4, 10), (5, 13), (6, 14)]

### Index without multiplicities

I want really the vector zz. Unfortunatelly as 5 is present with multiplicity 2 the only index for 5 is 0. I want also 2. How to obtain the desired return ?

So

z=[5,0,5,0,10,13,14,]
zz=[(z.index(v),v) for v in z if v!=0]
show(zz)


returns [(0, 5), (0, 5), (4, 10), (5, 13), (6, 14)] when I want [(0, 5), (2, 5), (4, 10), (5, 13), (6, 14)].