MEDIAN whats wrong in my code?


#1

def median(seq):
l=len(seq)
if l==1:
return seq[0]
for i in range(0,l-1):
for j in range(0,l-i-1):
if seq[j]>seq[j+1]:
temp=seq[j]
seq[j]=seq[j+1]
seq[j+1]=temp

if l%2==0:
    med=(seq[l/2] + seq[(l/2) - 1])/2.0
else:
    med=seq(int(l/2))
return med

It gives me an error telling:
Oops, try again.
median([6, 8, 12, 2, 23]) resulted in an error: 'list' object is not callable


#2

What's the syntax for calling something, such as a function?

See anything like that in your code?

In particular, do you see anywhere where the called value is not a function, but a list? You can't call a list, Python doesn't know what to do when you tell it to do that. So it stops.