Python Forum
How to calculate compounded profits on a given day?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to calculate compounded profits on a given day?
#10
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 += earning
This 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.
Reply


Messages In This Thread
RE: How to calculate compounded profits on a given day? - by perfringo - Aug-09-2020, 08:00 PM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020