list indices must be integers, not float
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))]