Question: This is my assignment in Python, all 3 exercises are under the same problem so this meets Chegg's Guidelines so I appreciate if all parts

 This is my assignment in Python, all 3 exercises are under

the same problem so this meets Chegg's Guidelines so I appreciate if

all parts were correctly coded, please and thank you. Given the following

This is my assignment in Python, all 3 exercises are under the same problem so this meets Chegg's Guidelines so I appreciate if all parts were correctly coded, please and thank you.

Given the following two-dimensional numpy array: In [ ]: primes = numpy. array([[2,17,41,37],[3,5,11,13],[19,23,61,73],[73,89,47,59]]) print(primes) a) Compute the length, shape and type of the primes array, assign them to variables named primes_len, primes_shape and primes_type, respectively, and print them. In [ ] : \# YOUR CODE HERE raise NotImplementedError() In [ ] : b) Using [ ] , access the first element of the third column, asssign it to a variable named var_1, and print the value of var_1. In [ ] : \# YOUR CODE HERE raise NotimplementedError() In [ ]: c) Using [ ] , access the third element of the fourth column, asssign it to a variable named var_2, and print the value of var_2 . In [ ] : \# YOUR CODE HERE raise NotimplementedError() In [ ] : d) Using [ ] , access the second element of the second row, assign it to a variable named var_3, and print the value of var_3. In [ ] : \# YOUR CODE HERE raise NotImplementedError() In [ ] : e) Using [ ] , access the fourth element of the first row, asssign it to a variable named var_4, and print the value of var_4. In [ ] : \# YOUR CODE HERE raise NotimplementedError() In [ ] : Exercise 2 Given the array, use slicing to solve the following problems. In[]:primes=numpy.array([[2,17,41,37],[3,5,11,13],[19,23,61,73],[73,89,47,59]])print(primes) a) Grab the second row, assign it to a variable named second_row, and print it. In[]:#YOURCODEHEREraiseNotImplementedError() In [ ]: b) Grab the last column, assign it to a variable named last_column, and print it. In [ ] : \# YOUR CODE HERE raise NotImplementedError() In [ ]: c) Grab the slice corresponding to the 2-by-2 top-left block of assign it to a variable named top_left, and print it. In [ ] : \# YOUR CODE HERE raise NotimplementedError() In [ ]: d) Grab the slice corresponding to the 2-by-2 bottom-right block of assign it to a variable named bot_right, and print it. In [ ] : \# YOUR CODE HERE raise NotImplementedError() In [ ] : e) Grab the slice that corresponds to all the elements except the first row and last column, assign it to a variable named and print it. In [ ]: \# YOUR CODE HERE raise NotimplementedError() In [ ] : f) Grab the slice corresponding to the 2-by-2 bottom-left block of primes, assign it to a variable named bot_left . Grab the slice that corresponds to the four elements in the top-right block, assign it to a variable named top_right. Create a new variable named sum_mat that is the result of adding bot_left and top_right, and finally print sum_mat. In [ ] : In [ ] : b) Create an array named that results from the following operation: ypos=R2x2 where Tip: For the square root use the numpy function

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!