Dec-16-2017, 11:51 AM
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.