Question: Problem Given two equal - sized numeric arrays a and b , write a function that compares a and b element - wise, i .

Problem
Given two equal-sized numeric arrays a and b, write a function that compares a and b element-wise, i.e., the first element of a to the first element of b, and the second element of b to the second element of b, ect. If a has an equal number of or more elements greater than b, then the function should return a with the count of elements that are greater than those of b. If b has more elements greater than a, then the function should return b with the count of elements that are greater than those of a.
Note: The grader generates random assessment cases and above example is not the only assessment cases. You should utilize 'Code to Call Your Function' script box and thoroughly test your function with more input arguments before making a submission (You can also copy-and-paste the input arguments from the grader's feedback).
Examples
aFunction([5,3,9,2],[1,3,5,7])
a=[5,3,9,2] and b=[1,3,5,7]
5>1,3==3,9>5,27
a has two elements greater than b and b has one element greater than a
The function should return 5,3,9,2 and 2
aFunction([5,3,9,2],[5,3,9,2])
a=[5,3,9,2] and b=[1,3,5,7]
5==5,3==3,9==9,2==2
a has zero elements greater than b and b has zero element greater than a
The function should return 5,3,9,2 and 0
aFunction([5,3,9,2],[10,10,10,10])
a=[5,3,9,2] and b=[10,10,10,10]
510,310,910,210
a has zero elements greater than b and b has four element greater than a
The function should return 10,10,10,10 and 4
Task
Write a function aFunction that takes up to two input arguments and returns two output values.
Hint
Logical arrays that are derived from relational operations are also numeric. You can use built-in functions like sum on logical arrays to count the number of 1's.
Problem Given two equal - sized numeric arrays a

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!