My code works well when the list has an uneven number of terms, but there is a problem when there are an even number of terms. Could you please help me find what's wrong?

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

`Replace this line with your code.`