Kodewick
Start learning →
Starter←→0 / 80

Fastest vs slowest

#007StarterFunctions3 min

At swimming practice, each length's time in seconds goes in a list (there's at least one). fastest_slowest(times) is written and returns (fastest, slowest). Write lap_gap(times): use it to get both, and return how many seconds slower the slowest length was.

Examples
lap_gap([62, 58, 65])→7
lap_gap([60])→0
main.py
def fastest_slowest(times):
    return min(times), max(times)


def lap_gap(times):
    fast = 0
    slow = 0
    # your code here: get fast and slow in one go from fastest_slowest(times)
    return slow - fast
Ctrl + Enter runs too
Result

Run tries the examples. When they look right, Submit.