Write a program to calculate the amount that will result from the doubling to understand which choice results in a larger amount | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

Write a program to calculate the amount that will result from the doubling to understand which choice results in a larger amount

Hint: Let's see how exponentiation can be useful to perform the calculation. For example, if we want to calculate how much money we will have on the 5th day, we can use this expression: 0.01*(2**5) = 0.32 dollars (multiply the penny by 2 raised to the power of 5). Output obtained should be 10737418.24

30th Oct 2020, 4:47 PM
JINI BIJU
JINI BIJU - avatar
2 Answers
+ 3
This sounds like mostly a math problem. It looks like you know to translate the math to Python. The ** operator in Python will likely help. math.log may help if you wanted to calculate number of days to reach a specific amount. What inputs do you want? The number of days, the initial amount? Will the unrealistically high interest rate of 100% per day be hardcoded so that it always doubles every day? You say the output should be 10737418.24. If the result is always the same, that's kind of weird so what do you mean?
7th Nov 2020, 2:52 AM
Josh Greig
Josh Greig - avatar
0
Like i'm confused
6th Jan 2021, 4:10 PM
Brian
Brian - avatar