Help me guys!! What's wrong with my code?
Fail: checkio([3,6,20,99,10,15])
TypeError: list indices must be integers, not float, checkio, 6
def checkio(data):
sorteddata = sorted(data)
if len(data)%2 == 0:
return float((sorteddata[len(sorteddata)/2] + sorteddata[len(sorteddata)/2])/2)
else:
return sorteddata[int(round(len(sorted_data)/2-1))]
Created at: 2016/05/03 14:25; Updated at: 2018/08/24 02:55