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 compound_by_period 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 1 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 compound_by_period 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 compound_by_period 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 built-in functions that youve already learned about, and store it in a variable named total_wheat. Print the value of total_wheat and compare your result with the total reported in the Wheat_and_chessboard_problem.
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 8/13/2024,9:17:40 PM
0/2 passed!
Tests that passed:
Tests that failed:
! Create function compound_by_period 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 blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!