Question: trying to test to raise a value error, and a type error: I tried using try except as well, can you help me understand what

trying to test to raise a value error, and a type error: I tried using try except as well, can you help me understand what i am doing wrong and what I am placing in the wrong spot.

def largest(list): if len(list) > 1: return list[0] raise ValueError('Please provide a non empty list') elif len(list) < 1: return largest(list[1:]) raise TypeError('the passed argument is not an array') print(largest([1,12,4,10])) print(largest([])) print(largest([1,2.2]))

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!