Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How many money in 30 days.
#3
import math

def money_days(start, days):
    power2days = math.pow(2, days)
    amount = start * power2days
    print(amount)

money_days(0.01, 30)
'''
The result is: 10737418.24
So, with the starting of 0.01 cents, after 30 days of doubling your money, 
the end result is: 10737418.24 cents or $107374.1824 depending on your currency denomination.
'''
To think another way for doing the math: instead of amount * 2 each time, do a power 2 of 30 times, which in python, you can use math.pow(x, y), or in your case: math.pow(2, 30); then multiply by the starting amount 0.01 (dollar or cents), the final result is what you want.
Reply


Messages In This Thread
How many money in 30 days. - by miguelramos122 - Dec-16-2017, 11:05 AM
RE: How many money in 30 days. - by j.crater - Dec-16-2017, 11:14 AM
RE: How many money in 30 days. - by zydjohn - Dec-16-2017, 11:51 AM
RE: How many money in 30 days. - by miguelramos122 - Dec-16-2017, 11:52 AM
RE: How many money in 30 days. - by squenson - Dec-16-2017, 12:48 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  How split N days between specified start & end days SriRajesh 2 2,333 May-06-2022, 02:12 PM
Last Post: SriRajesh
  Python code for counting money at multiple stores duddey 9 9,150 Oct-16-2020, 01:17 PM
Last Post: bill_z
  Money conversion - problems with lists and .format function fatherted99 1 2,455 Mar-12-2020, 06:29 PM
Last Post: ndc85430
  MONEY CHANGE OmarSinno 5 7,451 Oct-21-2017, 05:51 AM
Last Post: Larz60+

Forum Jump:

User Panel Messages

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