Answered step by step
Verified Expert Solution
Link Copied!

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 4: Reference 1 in the Wheat and Chessboard Wikipedia page lists an article entitled "A Penny Doubled Every Day for 30 Days = $10.7M". It turns out that $10.7M is an approximate total. Using your compound_by_period function, compute exactly how much money you would have if you started with a penny ($0.01) and doubled it every day for 30 days. Assign this total after 30 days to a variable named total_after_30.
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 penny-doubled-every-day problem is just a more conventional problem in compound interest, where the balance gets rolled over from day-to-day.
And here is my code
def compound_by_period(balance, rate, num_periods):
balances =[balance]
for n in range(1,num_periods+1):
balance = round(balance *(1+rate),2)
balances.append(balance)
return balances
balances =compound_by_period(0.01,1,30)
total_after_30=sum(balances)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Advanced Database Systems For Integration Of Media And User Environments 98

Authors: Yahiko Kambayashi, Akifumi Makinouchi, Shunsuke Uemura, Katsumi Tanaka, Yoshifumi Masunaga

1st Edition

9810234368, 978-9810234362

More Books

Students also viewed these Databases questions

Question

How are exchange rates determined under the gold standard?

Answered: 1 week ago

Question

What was the diagnosis Jim received after he was hospitalized?

Answered: 1 week ago