What is wrong with this code.

I get "Oops, try again. median [4,5,5,4] return 1 instead 4.5, when my list is [1], I get median [1] resulted error, list index out of range (I use PyCharm and there I don`t get any error)

```
lst = [1]
n = len(lst)
lst.sort()
def median(ls):
print ls
if n % 2 == 0:
m = n / 2
md = ls[m - 1] + ls[m]
med = (float(md)/2)
return med
else:
m = (n+1) / 2
print m
med = ls[m-1]
return med
print median(lst)
```