I am new to python, and I did do a search to try and find someone with a similar question and could not find anything, so here it goes!
I am trying to apply percentage changes to a list. So for example if we have:
list = [1,2,3,4,5,6]
I want to iterate through the list but using the formula (current value - previous value) / previous value ) * 100
In the provided list above it would be:
((2-1)/1)*100 and then ((3-2)/2)*100 etc. And then append to new list [100, 50, etc]
So far I have:
for i in equity:
equity_percentages.append(((i - equity[0])/equity[0])*100)
Which obviously only subtracts the first value in the list and then divides by that value as well. What I want to do is iterate through that list sequentially using the above mentioned formula.