Question: structions With your function compound _ by _ period in hand, we can apply it to a very different problem in compound interest: the wheat
structions
With your function compoundbyperiod in hand, we can apply it to a very different problem in compound interest: the wheat on a chessboard problem. First read this page if you are unfamiliar with the story. In this problem, the initial investment of grain of wheat is compounded for each square on the chessboard, leading to a staggering amount of wheat by the time the chessboard is filled. Your function compoundbyperiod is just what we need to compute how much wheat will actually end up on the chessboard.
With the answers to the previous three questions, write a Python statement that will compute the number of grains of wheat on each square of the chessboard, using the compoundbyperiod function you have written. Store the result in a variable named wheat, and print its value to the screen to marvel at how much wheat there is
The list named wheat that you produced reflects the number of grains on each square. Write an expression to compute the total number of grains on the board, using the list wheat and one of the builtin functions that youve already learned about, and store it in a variable named totalwheat. Print the value of totalwheat and compare your result with the total reported in the Wheatandchessboardproblem.
Before testing your code for correctness with the button below, enter run exercise.py in the IPython interpreter to ensure the file runs with no errors. If there are errors, use the information from them to debug your code.
Reset
Test Code
LAST RUN on :: PM
passed!
Tests that passed:
Tests that failed:
Create function compoundbyperiod that takes the initial balance, a fixed interest rate, and the number of time periods over which the balance is to be compounded, and returns a list of yearly balances.
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
