Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Need help modifying code for an array! Language:python. Thank you!! Write a code that makes a 2D square array with 20 x 20 elements. Fill

Need help modifying code for an array! Language:python. Thank you!!

image text in transcribed

Write a code that makes a 2D square array with 20 x 20 elements. Fill the array with random numbers initially. Then, "draw" a square in the array by adding a value of 4 to those array elements, and plot it with imshow. The square should be centered and have side lengths of 10. # rows size_1 = 20 # columns size_2 = 20 # fill the2D array with random numbers between @ and 1 data_new = np.random.random((size_1, size_2)) data_new[5:14,5) = 4 data_new[....] = 4 ### data_new[....] = 4 ### data_new[....] = 4 ### # check to see that it worked fig = plt. figure(figsize=(10,10)) plt.imshow(data_new) # play with different colors! # plt. imshow(data_new, cmap='plasma') # plt. imshow(data_new, cmap= 'magma') plt.colorbar()

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

Next Generation Databases NoSQLand Big Data

Authors: Guy Harrison

1st Edition

1484213300, 978-1484213308

More Books

Students also viewed these Databases questions