"The program took too long to finish. Check your code for infinite loops and try again."

```
def median(x):
a=[]
b=0
c=0
while len(a)!=len(x):
for l in x:
if l<b and l not in a:
a.append(l)
else:
a=a
b+=1
if len(a)%2!=0:
while len(a)!=1:
del a[0]
del a[len(a)-1]
for z in a:
c+=z
else:
while len(a)!=2:
del a[0]
del a[len(a)-1]
for z in a:
c+=z
c=c/2.0
return c
```