A function which sweep the indexes and doesn't stop at the first encounter
I would like to understand why the following code doesn't work
p=[-100,10,10,10,10,10,10,10,10,10,10]
[x/(1+.02)^(p.index(x)) for x in p]
what I was expecting is that for each x (p.index(x))
would be an other index. I remember that since 10 is of multiplicity 9, (p.index(x))
is the index of the first occurence of 9. So I ask if there is a function that sweep the index of all x with or without multiplicity.