Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Wheat on a chessboard, I need help. I have a task to come up with a plot using the matplotlib.pyplot module in python. Using the

Wheat on a chessboard, I need help.

I have a task to come up with a plot using the matplotlib.pyplot module in python.

Using the function

# %load WheatChessboard.py def compound_by_period(balance, rate, num_periods): """ Returns a list of balances by computing the compounded total, based on an initial balance and per-period interest rate over the specified number of compounding periods balance: Initial amount rate: increase at each period (supply percentage in decimal form) num_periods: the number of periods to compound the balance """ balances = [balance] for n in range(1,num_periods+1): balance = round( balance * (1 + rate), 2) balances.append(balance) return balances # wheat: list containing the number of grains of wheat on each square of the chessboard wheat = compound_by_period(1,1,63) total_wheat = sum(wheat) 

plot the list that contains the number of grains on each square. Using the plt.xlabel and plt.ylabel functions, label the x-axis as "square on chessboard" and label the y-axis as "number of grains on square". Both the plt.xlabel and plt.ylabel functions take a string argument and use that for the associated axis label.

In the resulting plot, note that the x-axis corresponds to the square number on the chessboard (from 0 to 63) and the y-axis corresponds to the number of grains on each square.

My plot should look like the attached.

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_2

Step: 3

blur-text-image_3

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

Securing SQL Server Protecting Your Database From Attackers

Authors: Denny Cherry

2nd Edition

1597499471, 978-1597499477

More Books

Students also viewed these Databases questions