Day 2Biggest Gap

    Very easylistsmin-max

    Write spread(nums) that returns the largest number in the list minus the smallest.

    For [3, 9, 1, 6] that is 9 - 1 = 8.

    Examples

    Example 1
    >>> spread([3, 9, 1, 6])
    8
    Example 2
    >>> spread([5])
    0

    Good to know

    • The list always has at least one number. With one number, the spread is 0.

    Run examples checks the 2 examples above. Submit runs all 6 tests, including hidden edge cases, and marks the challenge solved.

    solution.py
    Loading Python…

    Test results show up here

    Write spread in the editor, then run the examples. Use print() freely: its output is shown for each test.