# ——— DRILL ———- # write some code that computes the length and # position of the largest list in a list of lists L = [[1,2,3],[4,5,6,7],[8,9],[10]] maxLength = 0 maxPos = 0 i = 0 for l in L: if( len(l) > maxLength ): maxLength = len(l) maxPos = i i = i + 1 print( "max length is: " + str(maxLength) + " at position: " + str(maxPos) ) # a slightly more efficient version maxLength = 0 maxPos = 0 for i in range(0,len(L)): n = len(L[i]) # only compute once if( n > maxLength ): maxLength = n maxPos = i print( "max length is: " + str(maxLength) + " at position: " + str(maxPos) )