Aug-09-2020, 08:00 PM
If I understand the problem then very simple loop will suffice, example for 10 time units (days?):
investment = 228 rate = 0.2 / 100 for i in range(1, 11): earning = investment * rate print(f'{i:<4} {investment:<12.4f} {earning:<10.4f}') investment += earningThis will output to screen:
Output:1 228.0000 0.4560
2 228.4560 0.4569
3 228.9129 0.4578
4 229.3707 0.4587
5 229.8295 0.4597
6 230.2891 0.4606
7 230.7497 0.4615
8 231.2112 0.4624
9 231.6736 0.4633
10 232.1370 0.4643
I'm not 'in'-sane. Indeed, I am so far 'out' of sane that you appear a tiny blip on the distant coast of sanity. Bucky Katt, Get Fuzzy
Da Bishop: There's a dead bishop on the landing. I don't know who keeps bringing them in here. ....but society is to blame.
Da Bishop: There's a dead bishop on the landing. I don't know who keeps bringing them in here. ....but society is to blame.