tryprint getratios([ , , , ][ , , , ]print getratios([][]print getratios([ ][ ]except valueerrormsgprint msg prints [ nan [getratios called with bad arguments figure contains an implementation of the same specificationbut without using try-except def getratios(vect vect )"""assumesvect and vect are lists of equal length of numbers returnsa list containing the meaningful values of vect [ ]/vect [ ]""ratios [if len(vect !len(vect )raise valueerror('getratios called with bad arguments'for index in range(len(vect ))vect elem vect [indexvect elem vect [indexif (type(vect elemnot in (intfloat))or (type(vect elemnot in (intfloat))raise valueerror('getratios called with bad arguments'if vect elem = ratios append(float('nan')#nan not number elseratios append(vect elem/vect elemreturn ratios figure control flow without try-except the code in figure is longer and more difficult to read than the code in figure it is also less efficient (the code in figure could be slightly shortened by eliminating the local variables vect elem and vect elembut only at the cost of introducing yet more inefficiency by accessing each element repeatedly let us look at one more example