Can someone help me with my code?

def median(num_list):

sort = sorted(num_list)

length = len(sort)

if length % 2 != 0: #odd number list

a = length / 2

return sort[a]

```
elif length == 0: #even number list
b = length / 2
c = b - 1
d= (sort[b] + sort[c]) / 2
return d
```

I get an error saying that median([4, 5, 5, 4)] returned None, did you remember to return a result?

But I did return result d in the last line.