Problem 1

Import the NumPy library under the alias np.

In [ ]:
 

Problem 2

Create a NumPy array called my_array that contains the following elements: 1, 3, and 5.

In [ ]:
 

Problem 3

Create a two-dimensional NumPy array with 9 elements. The array should be called my_matrix and should have 3 columns and three rows. The matrix can contain whatever values you'd like.

In [ ]:
 

Problem 4

Use NumPy's arange method to generate the following output:

array([ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20])

In [ ]:
 

Problem 5

Use NumPy's arange method to generate the following output:

array([ 1, 4, 7, 10, 13])

Hint: You will need to use arange's third argument.

In [ ]:
 

Problem 6

Generate a NumPy array that contains 20 zeros.

In [ ]:
 

Problem 7

Generate a NumPy array that contains 50 ones.

In [ ]:
 

Problem 8

Using NumPy, divide the space between 0 and 100 into 1000 even intervals.

In [ ]:
 

Problem 9

Create a 10x10 identity matrix using NumPy.

In [ ]:
 

Problem 10

Returns a random sample of numbers with 10 values where each value is between 0 and 1.

In [ ]:
 

Problem 11

Returns a random sample of numbers with 10 values where each value is between 0 and 10.

Hint: Use the random.rand method combined with a multiplication operation.

In [ ]:
 

Problem 12

Generate a random sample of 15 numbers from a normal distribution.

In [ ]:
 

Problem 13

Generate a random sample of 7 integers that range between 5 and 10.

In [ ]:
 

Problem 14

Reshape the following one-dimensional NumPy array into a two-dimensional Numpy array with 3 rows and 3 columns.

In [ ]:
arr = np.array([0,1,2,3,4,5,6,7,8])

Problem 15

Print the minimum and maximum values of the following NumPy array.

In [ ]:
arr = np.array([0,1,2,3,4,5,6,7,8])
In [ ]:
#Print the minimum value here.
In [ ]:
#Print the maximum value here.

Problem 16

For the following NumPy array, print the index of the minimum and maximum values.

In [ ]:
my_array = np.array([6, 7, 0, 2])
In [ ]:
#Print the minimum value's index here.
In [ ]:
#Print the maximum value's index here.