Hi all, here's my code of which I get the error:

Oops, try again. median([4, 5, 5, 4]) returned 5.0 instead of 4.5

I guess the problem might be due to the sorted function, but I'm not sure.

I checked the usage of the sorted function and it looks like that it changes the original list, so I don't see the

problem in my code....

Help?

def median(lst):

lstSize = len(lst)

```
# Sort the list
sorted(lst)
if not lstSize % 2 == 0:
# If the size of the list is odd, just return the median
# To find the index of median - remove 1 from the list size and divide by 2
return lst[(lstSize-1)/2]
else:
# The size of the list is even
# To find the index of median - divide the list size by 2 and take this index
# plus the index - 1
return (lst[lstSize/2] + lst[(lstSize/2)-1])/2.0
```