Median 15 is making me crazy


#1

def median(liste):
liste = sorted(liste)
if len(liste) % 2 == 0:
a = liste[len(liste)//2]
b = liste[(len(liste)//2)-1]
return (a+b)/2
else:
return liste[len(liste)//2]


Seriously, I don't know what's wrong... It works fine on the Python IDLE...


#2

this line ought to be

return (a+b)/2.0

#4

@rydan Thank You! It worked, Finally!!