Question: *using python 2. Write a function compare(list1, list2) that takes as inputs two lists of numbers, listl andlist2, and that uses recursion to compute and
*using python
2. Write a function compare(list1, list2) that takes as inputs two lists of numbers, listl andlist2, and that uses recursion to compute and return the number of values in list1 that are smaller than their corresponding value in list2. In other words, the function should compare list1[0] with list200], list101] with list2[1], list1[2] with list212], etc, and it should return the number of positions at which the value from listi is smaller than the value from list2. For example: compare([S, 3, 7, 9, 1], [2, 4, 7, 8, 3]) 2 The above call returns 2, because: in position 0, 5> 2 in position 1,3 8 - in position 4,1 1, 2 0; can't compare 8
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
