Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

4.Largest List Item Design a function that accepts a list as an argument and returns the largest value in the list. The function should use

4.Largest List Item

Design a function that accepts a list as an argument and returns the largest value in the list. The function should use recursion to find the largest item.

This is the code I got so far. I am just stuck on the else statement

if you could add comments to the else statement so i understand what is going to be written there I would appreciate it. thank you

#Design a function that accepts a list as an argument and returns the largest #value in the list. The function should use recursion to find the largest item.

def main1(): #ask the user for a list list = [1, 5, 6, 7, 3, 9, 2, 15, 20, 2] print(get_lrg_value(list)) def get_lrg_value(list): if len(list) == 1: return list[0] else: main1()

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

3. Explain the forces that influence how people handle conflict

Answered: 1 week ago