Light Mode
Dark Mode
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))]

Created: May 3, 2016, 2:25 p.m.
Updated: Aug. 24, 2018, 2:55 a.m.
0
10
User avatar
novikovandrey1984