• solution isn't work

 

I would like to give some feedback about ...

From: http://www.checkio.org/mission/median/solve/

HTTP_USER_AGENT:

Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.95 Safari/537.36

I think that this solution is right(for python): checkio=lambda data: data[len(data)/2] if len(data)%2 else ((data[len(data)/2-1]+data[len(data)/2])/2.0)

errors like that:

checkio([1,2,3]) TypeError: list indices must be integers, not float <lambda>, 6 <module>, 1

is a result of JS implementing or somewhat else, in my ipython it works like that: In [21]: med=lambda data: data[len(data)/2] if len(data)%2 else ((data[len(data)/2-1]+data[len(data)/2])/2.0)

In [22]: med([1,2,3,5]) Out[22]: 2.5

In [23]: med([1,10,2,9,3,8,4,7,5,6]) Out[23]: 5.5

Of course, that solution shouldn't be very recommended but as proof it could be usefull