Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Write a function called find_second_largest() that takes as input a list of numbers called myList . The function should find the second largest number in
Write a function called find_second_largest() that takes as input a list of numbers called myList. The function should find the second largest number in the list and return it. If the list is empty or only have a single number in it the function should return 0.
Do not call the function, it will be called by the test program.
Test | Result |
thelist = [3,1,5,7,9,4] print(find_second_largest(thelist)) print(*thelist, sep = ' ') | 7 3 1 5 7 9 4 |
thelist = [] print(find_second_largest(thelist)) print(*thelist, sep = ' ') | 0 |
thelist = [3] print(find_second_largest(thelist)) print(*thelist, sep = ' ') | 0 3 |
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started