0% found this document useful (0 votes)
6 views2 pages

Mabaquiao Firstname Mp2

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views2 pages

Mabaquiao Firstname Mp2

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Filename: SURNAME_FIRSTNAME_MP2

Answer the questions or complete the tasks outlined in bold


below, use the specific method described if applicable.

1. Import NumPy as np
#Write your code here
import numpy as np

2. Create an array of 20 zeros

#Write your code here


zeros_array = np.zeros(20)

3. Create an array of 20 ones


#Write your code here
ones_array = np.ones(20)

4. Create an array of 20 fives


#Write your code here
fives_array = np.full(20, 5)

5. Create an array of the integers from 10 to 70


#Write your code here
integers_array = np.arange(10, 71)

6. Create an array of all the even integers from 10 to 70


#Write your code here
even_integers_array = np.arange(10, 71, 2)

7. Create a 3x3 matrix with values ranging from 10 to 18


#write your code here
matrix_3x3 = np.arange(10, 19).reshape(3, 3)

8. Create a 4x4 identity matrix


#write your code here
identity_matrix = np.eye(4)
9. Use NumPy to generate a random number between 0 and 5
#write your code here
random_number = np.random.uniform(0, 5)

10. Use NumPy to generate an array of 50 random numbers


sampled from a standard normal distribution
#write your code here
random_array = np.random.randn(50)

Numpy Indexing and Selection

11. Run this Cell – This is our starting matrix


import numpy as np
matrix = np.arange(1,51).reshape(5,10)
matrix = np.arange(1, 51).reshape(5, 10)

12. Get the sum of all the values in matrix


#write your code here
matrix_sum = matrix.sum()
13. Get the standard deviation of the values in matrix
#write your code here
matrix_std = matrix.std()

You might also like