View the step-by-step solution to:

# 2. Below is a recursive program that finds the largest element in a list. 5 pts This question was created from Ch011- Hw11.docx

This question was created from Ch011- Hw11.docx https://www.coursehero.com/file/31039770/Ch011-Hw11docx/

2. Below is a recursive program that finds the largest element in a list. 5 pts def largest(data) : if len(data) == 1 : return data[0] largestRest = largest(data[0 : -1]) if largestRest < data[-1] : return data[-1] else : return largestRest def main() : # Demonstrate the largest function. print(largest([10, 12, 33, 8, 52, 49, 23, 14, 1])) print("Expected: 52") # Call the main function. main() Write a recursive program that finds the smallest element in a list. (include print statements that show the trace of the variables changing) a) Your code with comments b) A screenshot of the execution

2. Below is a recursive program that finds the largest Element in a list . 5 pts

Please find the solution below. Let me know if you have any doubt. def smallest (data) : if len(data) == 1 : return data[... View the full answer

### Why Join Course Hero?

Course Hero has all the homework and study help you need to succeed! We’ve got course-specific notes, study guides, and practice tests along with expert tutors.

### -

Educational Resources
• ### -

Study Documents

Find the best study resources around, tagged to your specific courses. Share your own to gain free Course Hero access.

Browse Documents