Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started