Create a one dimensional array that has the range 1 to 1000 divided into 20 parts.
Create an array that has the dimensions 5 rows x 5 columns.
Sort each row of the array.
Add another column to the array.
Recourses:
Class slides: https://docs.google.com/presentation/d/1xoS64IpN-Kq3IfZNtTA78q3LUPOLBs_B_eox4UWu6aM/edit#slide=id.g2058d1d15c8_0_7
Class code: https://replit.com/join/hwonleegzr-shrav816
Contact Info:
shravyassathish@gmail.com (mentor)
kingericwu@gmail.com (TA)
felixguo41@gmail.com (TA)
import numpy as np
1.)
array = np.linspace(1,1000,20)
2.)
array1 = np.random.randint(1, 1000, size=(5, 5))
print(array1)
array2 = np.array([[1, 1, 1, 1, 1], [2, 2, 2, 2, 2], [3, 3, 3, 3, 3], [4, 4, 4, 4, 4], [5, 5, 5, 5, 5]])
a.)
array3 = np.sort(array1, axis=1)
b.)
array4 = np.concatenate((array3, array2), axis = 1)
import numpy as np
n1 = np.linspace(1,1000,20)
print(n1)
n2 = np.array([[1,2,3,4,5],[82,56,39,91,2],[10,13,6,27,62],[87,63,45,2,0],[7,2,5,3,4]])
sortArray = np.sort(n2,axis=1)
print(sortArray)
addArray = np.concatenate((n2,[[5],[6],[7],[2],[10]]),axis = 1)
print(addArray)