Hi, guys! Could anyone please explain why this code doesn't work correctly - it returns 5.0 instead of 4.5, I thinks that the mistake is somewhere after the "elif" statement, but I can't understand it and comments don't help. thanks in advance.

```
from math import *
def median(ar):
sorted(ar)
med = 0
l = len(ar)
if l%2 > 0:
ind = int(math.ceil(l/2) - 1)
med = ar[ind]
elif l%2 == 0: # Remainder from division (in this case 4%2 == 0)
ind1 = l/2 # ind1 = 4/2 = 2.0
one = ar[int(ind1)] # ar[2] = 5
ind2 = ind1 - 1 # ind2 = 2 - 1 = 1
two = ar[int(ind2)] # ar[1] = 4
med = (one + two)/2.0 # (5 + 4)/2.0 = 4.5
return med
ar = [4, 5, 5, 4]
print median(ar)
```