So I am asked to write a function called find_min that takes a list of lists and returns the minimum value across all lists. No more info was provided. I have been provided the lists, I must test it with the following:
if __name__ == "__main__":
v = [ [ 11,12,3], [6, 8, 4], [ 17, 2, 18, 14] ]
print("Min of list v: {}".format(find_min(v)) )
u = [ [ 'car', 'tailor', 'ball' ], ['dress'], ['can', 'cheese', 'ring' ], \
[ 'rain', 'snow', 'sun' ] ]
print("Min of list u: {}".format(find_min(u)) )
This is what I have so far:
def find_min(x):
for i in x:
i == 0
i += 1
minx = min(x[i])
if i == 4:
break
return minx
I wrote this to try to get through every list. I didn't want to ask without at least a bit of code written. I am new at Python so any help or tips would be greatly appreciated!