Question: Create a Numpy array A which has the elements [ 1 , 2 , 3 , 4 , 1 ] in the first row, and

Create a Numpy array A which has the elements [1,2,3,4,1] in the first row, and the elements [5,2,1,4,2] in the second row, and then perform the following set operations between Z and A:
(Note: We discussed set operations as part of python basics)
(Note: The resultant arrays need not be in the same shape and dimensions as the arrays Z and A)
o Compute an array which has the elements present in Z but not in A
o Compute an array with the sorted common elements that are present in Z and A
o Compute the sorted union of Z and A
o Compute a Boolean array indicating whether each element of Z is contained in A
o Find those elements which are either in Z or A, but not both arrays

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 Programming Questions!