Feedback from user tilikum
Hey,
This should work
def checkio(data):
if len(data) % 2 == 0:
medi = (data[(len(data)/2)-1] + data[len(data)/2])/2
return medi
else:
medi = data[(len(data)-1)/2]
return medi
i still get an error that "list indices must be integers, not float". @ line 6
the calculation gives only an int, yet.. error
URL from: http://www.checkio.org/mission/median/solve/
HTTP_USER_AGENT: Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/34.0.1847.137 Safari/537.36
This should work
def checkio(data):
if len(data) % 2 == 0:
medi = (data[(len(data)/2)-1] + data[len(data)/2])/2
return medi
else:
medi = data[(len(data)-1)/2]
return medi
i still get an error that "list indices must be integers, not float". @ line 6
the calculation gives only an int, yet.. error
URL from: http://www.checkio.org/mission/median/solve/
HTTP_USER_AGENT: Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/34.0.1847.137 Safari/537.36