Question: PYTHON PROGRAMMING DO NOT USE ANY KINDS OF LOOPS, ONLY USE RECURSION Differences. For this question assume we are only dealing with lists of integers
PYTHON PROGRAMMING 
DO NOT USE ANY KINDS OF LOOPS, ONLY USE RECURSION Differences. For this question assume we are only dealing with lists of integers Given a list L with at least 2 numbers define the list difference of L, diff(L), to be the list that is generated by subtracting adjacent elements of L from left to right. For example ifL5,2,-4,3,2] then diff(L)[3,6,-7,1 Further, define the difference number of L to be the amount of repeated list differences needed to generate a constant list from L. A constant list is a list of numbers that are all the same. For example: M[17,2,5,26,65, 122] diff(M) [15, -3, -21, -39, -571 diff(diff(M))[18,18,18,18] Background: Given a list of numbers that represent y coordinates, if the x coordinates are assumed to be evenly spaced then the difference number will tell you what degree polynomial can be used to intersect all of the points. In the example above with M [17,2,5,26,65,122] a second degree polynomial ax2 +bx+c can be made to intersect these points (assuming evenly spaced x coordinates) and the difference number of M is 2. Note that every list of length 1 will have a difference number of 0. Write the function diff_num that consumes a non-empty list of numbers, lon and returns the difference number of lon. Note that your function must not mutate the original list For example: diff_num([17,2,5,26,65,122])2 diff numCCS,2,-4,3,2]) 4
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
