This is the code I came up with that succeeded, but I was wondering if there were any obvious spots I could make more efficient, because I’m sure there are.

```
def median(x):
med = 0
sort = sorted(x)
halflen = (len(sort) / 2)
if len(sort) == 1:
med = x
elif len(sort) % 2 == 0:
med = (sort[halflen - 1] + sort[halflen]) / 2.0
else:
med = sort[int(halflen + 0.5)]
return med
```