I created a simple royalty calculator, but what I would like to now do is make it so that it separately calculates x number of times like this:
x = x + (x * .10)
I need it to repeat incrementally with the total going into and setting the new value of x for the next iteration. So say I want to print out the results of that 10 times, with each time adding the new totals into the equation, so for example, these results might come up if you started with an amount of 1.00:
1.10
1.21 (1.10 + an extra 10 %)
1.33
1.46
and so on for however many times you need. Here is what I was trying and I'm stuck on this. I am also thinking of making the user input the initial amount.
for _ in range(10):
new_total = total + (total * .10)
print new_total
How can I make this happen? This only prints the first iteration and not all 10. Keep in mind that the total variable gets determined by the other parts of the script that works before this piece of code.
new_total =tototal =, andprint new_totaltoprint total?printis at the right level - looks like it should be outside theforlooptotal *= 1.10