Question: In Python: Write a function diff(vals1, vals2) that takes as inputs two arbitrary lists of non-negative integers vals1 and vals2 and uses recursion to construct

In Python: Write a function diff(vals1, vals2) that takes as inputs two arbitrary lists of non-negative integers vals1 and vals2 and uses recursion to construct and return a new list in which each element is the the absolute value of the difference of the corresponding elements from the original lists. For example:

>>> diff([3, 4, 2, 5], [7, 2, 9, 5]) result: [4, 2, 7, 0]

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!