Question: 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

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 Databases Questions!