Professional Documents
Culture Documents
Def Arraychangerpart1 (Myarray, Num1, Num2) : ''' Do Part 1 of The Question ''' # Your Code Here Raise Notimplementederror
Def Arraychangerpart1 (Myarray, Num1, Num2) : ''' Do Part 1 of The Question ''' # Your Code Here Raise Notimplementederror
Def Arraychangerpart1 (Myarray, Num1, Num2) : ''' Do Part 1 of The Question ''' # Your Code Here Raise Notimplementederror
(1) a 2-D numpy array, myArray, of some arbitrary size, say m rows x n columns
Part(1) return a new array myArray_new by replacing the last-but-one column of myArray with an
array of elements comprising the sum of the least value of each row of myArray and num1
Part(2) return a new array myArray_new2 by replacing the last row of myArray_new with an array
of elements comprising the sum of the highest value of each column of myArray_new and num2
Part(3) return a 2-D array myArray_new3 of the same shape as myArray i.e. m x n by sorting
ALL the elements of myArray_new2 from lowest to highest.
The code is broken into parts for your ease. Note: Each part must cumulatively do what is
required by the previous parts. i.e. for e.g., the function you write in Part 3 will have all the lines
of code in Part1, and Part2. Similarly, the function you write in Part 2 will have the lines of code in
Part1 and then the lines to implement Part 2.
Cumulative marks: Part1: 3, Part2: 6, Part3: 10 Thus, if you get parts 1 and 2 correct, but not part
3, you get 6 marks out of 10
def arrayChangerPart1(myArray,num1,num2):
'''
'''
raise NotImplementedError()
In the cell below, write a function that takes two aruguments as follows:
(1) a 2-D numpy array, myArray, of some arbitrary size, say m rows x n columns, containing
numbers in the interval [0,1]
2a: in each column of myArray, find the index (or row number) of
the element that is closest to num1. i.e. The function in
Part2a must return a numpy array with a row number from each
column -it has number of elements equal to number of columns.
The code is broken into parts for your ease. Note: Each part must cumulatively do what is
required by the previous parts. i.e. for e.g., the function you write in Part 4 will have the lines of
code in Part1, Part2, and Part3 and then the lines to implement Part 4. Similarly, the function you
write in Part 2 will have the lines of code in Part1 and then the lines to implement Part 2.
Cumulative marks: Part1: 1, Part2a: 4, Part2b: 7, Part3: 8, Part4: 10 Thus, if you get parts 1, 2a
and 2b correct, but not parts 3 and 4, you get 7 marks out of 10
def arrayModifierPart1(myArray,num1):
"""
"""
raise NotImplementedError()