Question: 6 . In Python, execute the following code: import numpy as np normal _ 9 = np . random.randn ( 9 ) normal _ 9

6. In Python, execute the following code:
import numpy as np
normal_9= np.random.randn(9)
normal_9.shape =(3,3)
normal_3= normal_9[1]
Then answer the following questions:
a) Explain what each statement in the above code does.
b) What class is the object named normal_9? How do you know?
c) What statement can you write to find the maximum value in normal_9?
d) What statement can you write to create an array named normal_6 that
contains the values in the 1st and 3rd rows of normal_9?
e) What happens to normal_3 and normal_6 if we execute the statement
normal_9[1]=0? Why?
f) What happens to normal_3 and normal_6 if we execute the statement
normal_9[2,2]=0? Why?
g) What happens to normal_3 and normal_6 if we execute the statement
normal_9=1? Why?

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 Databases Questions!