logo CodeStepByStep logo

find_range_2d

Language/Type: Python list of lists traversals
Author: Allison Obourn (on 2017/09/01)

Write a function named find_range_2d that accepts a list of lists of integers as a parameter and returns the range of values contained in the list of lists, which is equal to one more than the difference between its largest and smallest element. For example, if the largest element is 17 and the smallest is 6, the range is 12. If the largest and smallest values are the same, the range is 1. If the list is empty your function should return 0.

Constraints: You may not create any other data structures You may not modify the contents of the list.

Function: Write a Python function as described, not a complete program.

You must log in before you can solve this problem.

Log In

Need help?

Stuck on an exercise? Contact your TA or instructor.

If something seems wrong with our site, please

Is there a problem? Contact us.