Testing median

Testing median#

Complete the tests for the median1 and median2 function so that the tests fail, i.e., write enough tests to help you find the bug between both median functions by writing tests for both that will either pass or fail.

We’ll run your code on the following definition of median (median2 in this case) as well as a correct one:

def median(l):
    l = list(l) # copy the list
    l.sort() # sort it
    return l[len(l) // 2]