Select Page

Berkshire Community College Computer Science Find Max in A List Python Program

Question Description

Write a function called findMax that takes a list of lists of numbers called lists. Your function should return -1 if all of the lists are empty. Your function should be placed in a file called FindMax.py.

Edit the function findMax so that it also returns -1 if at least one of the numbers in lists is negative.

Edit the function findMax so that when all of the lists are not empty, and there are no negative numbers in lists, the function returns the largest value in all of the lists in lists.

Example of Program:

largest = findMax([ [1,3,5], [], [43, 2, 9], [23, 1] ])

print(“Largest: %s” % largest)

largest = findMax([ [], [] ])

print(“Largest: %s” % largest)

largest = findMax([ [1,-3,5], [], [43, 2, 9], [3]. [7, 2] ])

print(“Largest: %s” % largest)

Produces the following output:

Largest: 43

Largest: -1

Largest: -1

"Place your order now for a similar assignment and have exceptional work written by our team of experts, guaranteeing you "A" results."

Order Solution Now