Question: IN JUPYTER NOTE Step 4 : Reference 1 in the Wheat and Chessboard Wikipedia page lists an article entitled A Penny Doubled Every Day for
IN JUPYTER NOTE
Step : Reference in the Wheat and Chessboard Wikipedia page lists an article entitled "A Penny Doubled Every Day for Days $M It turns out that $M is an approximate total. Using your compoundbyperiod function, compute exactly how much money you would have if you started with a penny $ and doubled it every day for days. Assign this total after days to a variable named totalafter
Note: this is a little bit different than the wheat and chessboard problem, because there the amount of wheat being placed on a square was doubled every day, but the total amount of wheat on the board is the cumulative sum over all squares up to the current one. The pennydoubledeveryday problem is just a more conventional problem in compound interest, where the balance gets rolled over from daytoday.
And here is my code
def compoundbyperiodbalance rate, numperiods:
balances balance
for n in rangenumperiods:
balance roundbalance rate
balances.appendbalance
return balances
balances compoundbyperiod
totalaftersumbalances
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
