Could anyone please explain to me why this is not working? The error message I'm getting is: TypeError: list indices must be integers or slices, not float.
def median(lst):
s = sorted(lst)
l = len(lst)/2
if len(lst) % 2 == 0:
print((s[l] + s[l-1])/2.0)
else:
print(s[l])
median([3,3,5,6,7,8,1])