Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

lainalizer Create the following array in at most 3 lines of code and return it on the 4th line. [[1,1, 1, 1] [1,1, 1, 1)

image text in transcribed
image text in transcribed
lainalizer Create the following array in at most 3 lines of code and return it on the 4th line. [[1,1, 1, 1] [1,1, 1, 1) [1,1,1,2] [1, 6, 1,1] larger diagonals (A, B) Given two numpy ndarrays A and B: return A if the average of A's diagonal entries is higher than the average of B's diagonal entries return B otherwise add_columns(A) Given an NxM array called A (M is even and M 2 2): Use array slicing to get a new array composed of only A's even columns Use array slicing to get a new array composed of only A's odd columns Element-wise add the two arrays and return the result . rank.calculator(A) Given a numpy odarray A, return its rank array. Input: [[9 415 018] [1619 8 10 1]] Return value: [[4 2 6 0 8] [79351) Return value should be an ndarray of the same size and shape as the original array A. scoate...checkerboard(n) Given N. create an NxN array with a checkerboard pattern of zeros and ones. Use slicing. Example for N = 6: [[O 1 0 1 0 11 (101010 10 10 10 11 10 10 1 ) [0 10101] [10101 02 I import numpy s np det initializer): return -1 def larger_diagonals(A, B) : return -1 def add_columns(A): return -1 def rank_calculator(A): return -1 def create_checkerboard(n): return -1 def main(): 1 You can test your functions using the function calls below. Uncomment to use them, When submitting, make sure you submit a version that does not contain syntax errors. a = np.array([(4,5,101, (6,7,21]) b = np.array([[8.4, 3.2, 6.51, 19.1, 7.4, 6.1))) print(a) print(b)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions