• Problem with median mission

 

I would like to give some feedback about ...

I had to solve the same problem on another website (codecademy.com) and after copying and pasting the solution:

x.sort() n = len(x)

if n % 2 != 0:
    i = x[((n + 1)/2) - 1]
    return i
else:
    i1 = x[(n / 2) - 1]
    i2 = x[((n / 2) - 1) + 1]
    i3 = (i1 + i2) / 2.0
    return i3

...I got an error saying that indices in lists should be integers not floats. Not sure why it isn't working From: http://www.checkio.org/mission/median/solve/

HTTP_USER_AGENT:

Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.132 Safari/537.36
2