All problems
Range
Problem
Return max(data) - min(data), the simplest measure of spread. Return 0.0 for an empty list.
Hint
Two built-ins and a subtraction.
Test cases
case 1
in: [[4,1,9,2]]
expected: 8
case 2
in: [[5]]
expected: 0
case 3
in: [[]]
expected: 0
case 4
in: [[-3,7]]
expected: 10
case 5
in: [[2,2,2]]
expected: 0
Starter codePython
def value_range(data):
# Your code here
pass5 test cases · run your code against them in the editor