#File: ChapterRecursion/maxlist.py """ Find the largest number in sequence A, assume max is a 2 arity function. """ A = [ 1, 7, -4, 5, 0 ] def findMax( A ): # If there is only one number left in the sequence # it must be the largest if len(A) == 1: return A[0] # else, find the max of the last element and the rest of the array return max( A[-1], findMax( A[:-1] ) ) def main(): # call your recursive function on A print("The largest number in the sequence is", findMax( A )) main()