Skip to content
DeepForgeby svx
All problems
EasyStatisticsst-011

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
    pass

5 test cases · run your code against them in the editor