Question: Language: python 3 Provide screenshot 3. (13 points) Write a function chessBoard(m, n) that takes as input two integers m and n, and returns a
Language: python 3 Provide screenshot

3. (13 points) Write a function chessBoard(m, n) that takes as input two integers m and n, and returns a 100 x 200 NumPy array that represents an mx n black and white chessboard image. We assume that each pixel in the image is represented by a single real number between 0 and 1, representing the gray scale from black to white. Note: You should only use Numpy and Matplotlib for this problem. To get full credits, you should avoid using any explicit for/while loops. In [ ]: # run this cell to import necessary modules # DO NOT DELETE import matplotlib.pyplot as plt import numpy as np In [ ]: # put your code here Test your function by running the following cell. In [ ]: # Test your code here # DO NOT DELETE img = chessBoard(5,10) plt.imshow(img, cmap = "gray") plt.show() The resulting image should be similar to the following image: In [1]: # Run the cell to show the test image # DO NOT DELETE from IPython.display import Image, display display (Image("chessboard_demo.png")) 0 20 40 60 80 0 25 50 75 100 125 150 175
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
