Question: Build a 5X4 array with random integer between 1 and 100. The required arguments of the creation function to do this is np.random.randint(low, high, size).

 Build a 5X4 array with random integer between 1 and 100. The required arguments of the creation function to do this is np.random.randint(low, high, size). As usual, low is inclusive and high is exclusive.

1.2 Change the element of second row/third column to 0

1.3 Create a slice of two rows and three columns (row 2 and 3, column 2-4). Your way of creation should guarantee that changing the slice will not change the original array. Change the element at row 2 and column 2 in the slice to 100. Print the slice before and after change.

1.4 Create a two-dimensional array with 5 integers in one row. You can create it your own way. Can this array and the one created in 1.1 be added together?

1.5 Following 1.4, how can we make the two arrays add together?

1.6 Multiply the elements (in the 5X4 array created in 1.1) that are divisable by 3 with 2.

1.7 Calculate the mean and the standard deviation of each column using aggregation functions of the array from 1.1. Use the mean and std to get the standardized value of each element using the formula: (x - mean)/std, where x is the element. Tips: Which axis should we use?

Step by Step Solution

3.45 Rating (152 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

import numpy as np 11 Create a 5x4 array with random integers between 1 and 100 arr nprandomrandint1 ... View full answer

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!