Problem 1

Import the NumPy library under the alias np.

In [ ]:
 

Problem 2

Given the following NumPy array, return the first element and the last element.

In [ ]:
arr = np.array([8,2,4,9,7,3,8,1])
In [ ]:
#Return the first element here
In [ ]:
#Returns the last element here

Problem 3

Given the following NumPy array, return the entire array except for the last element.

In [ ]:
new_arr = np.array([1,6,4,8,7,5,2,1,4,5,6,1,4,5,6,2,1])
In [ ]:
#Place your solution here

Problem 4

Change the second element of this_arr to 4.

In [ ]:
this_arr = np.array([2,4,89,7,5,4,2,6,4,5,78,1,6,9,7,456,12,45])
In [ ]:
#Place your solution here
this_arr[1] = 4

Problem 5

Given the array original_array, create a reference to that array called reference_array. Change the second element of reference_array to 16 and then print original_array to verify that it modified the original data structure.

In [ ]:
original_array = np.array([12,45,86,79,45,26,13,46,28])
In [ ]:
#Solution goes here

Problem 6

Given the array first_array, create a copy of the array called copy_array. Change the third element of copy_array to 42 and then print first_array to verify that its elements remain unchanged.

In [ ]:
first_array = np.array([16,45,75,16,43,45,78,19,23,46,79,58])
In [ ]:
#Solution goes here

Problem 7

Given the two-dimensional array matrix, print the value 35.

In [ ]:
matrix = np.array([[15, 120, 115],[230, 35, 130],[335, 420, 425]])
In [ ]:
#Solution goes here

Problem 8

Given the array integer_array, print a NumPy array of Boolean values that indicate whether the corresponding values in integer_array are greater than 4.

In [ ]:
integer_array = np.array([2,6,4,9,8,5,3,1,2,5,4,8,7,5,6])
In [ ]:
#Solution goes here

Problem

Given the same array integer_array, print a new NumPy array that only includes the values from integer_array that are less then 6.

In [ ]: