Question: 3. Write a recursive Python function that expects one argument, a Python list of integers, and returns the largest integer in the list. Thinking

3. Write a recursive Python function that expects one argument, a Python

 

3. Write a recursive Python function that expects one argument, a Python list of integers, and returns the largest integer in the list. Thinking recursively, the largest integer is either the first integer in the list or the largest integer in the rest of the list, whichever is larger. If the list has only one integer, then the largest integer is this single value. You may assume that the list has at least one element. You may assume that the list has at least one element. Here are some examples: >>> findLargest ([1, 7, 35, 12, 19, 106, 0]) 106 >>> findLargest ([42]) 42 (Helpful Python syntax: If A is a list of integers, and you want to set the list B to all of the integers in A except the first one, you can write B =A[1:])

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!