I'm sorry for the rudimentary question about Python's For statement,
The following formula does not show why the compounding of the principals (Savings) is calculated.
savings = 100
for i in range (15):
savings + = savings * 0.05
print (savings)
This result is about 207.9 (15year compound interest calculation with a principal of 100 and an interest rate of 5%).
If savings + = savings * 0.05, then 100 + 100 * 0.05 would be 105, and that would be repeated 15 times.

Answer # 1

Answer # 2
15% interest rate of 15% Since the annual compounding calculation,
savings + = savings * 0.05
can be rewritten assavings * = 1.05
. You will see whether savings * 0.05is fine.As Katoy mentioned,
savings
is avariablethat changes with each loop.savings = 100 for i in range (15): savings * = 1.05 print (savings) print (savings)

Answer # 3
savings + = savings * 0.05 is
Savings = savings + savings * 0.05
If you transform the formula
You can also write savings = savings * 1.05If this is the case
It is the definition of compound interest calculation itself.savings = 100 for i in range (15): print (savings) # try to write output savings = savings * 1.05 print (savings)
The results are printed below.
100
105.0
110.25
115.7625
121.55062500000001
127.62815625000002
134.00956406250003
140.71004226562505
147.74554437890632
155.13282159785163
162.8894626777442
171.03393581163144
179.58563260221302
188.56491423232367
197.99315994393987
207.89281794113688
Related articles
 about repeated operations in python for statement
 python  about importing intertools
 python  about the list when calling a function in another file
 [python] about aoj0105 book index
 python  about the error "allocation of 536870912 exceeds 10% of system memory" when learning cnn
 [python] about atcoder arc006b
 python  about a problem of satcoder agc39
 python  about keras maxpooling2d
 python  [django] about access from another terminal in lan
 python  about tkinter line creation (?)
 python: about list arguments
 about installing python
 tell me about python iteration statements
 [python3] i want to use if statement in integration using sympy
 about installing pythontwitter ・i would like to know the difference between tweepy and pythontwitter
 about line break display in python
 about python flask
 about list behavior in python
 about installing python on mac
 about python timeout
 python  how to remove a list from a tuple and store only the value
 python  with pycharm, processing does not proceed without error
 python  regarding the problem that tries to decompose a string apostrophe using a dictionary but fails
 python  common behavior for everything in django
 python  i want to split one array into two without duplication
 about the problem that float subtraction does not work in numerical calculation in python
 python  something went wrong in the jupiter lab
 python  i cannot put multiple data scraped by selenium in django into a list and display it
 python  how to deal with error when converting pandas datetime type
 i want to read python time series data while shifting by 1 day
saing changes in the loop.
Try executing the print statement.
Execution example