kindly identify the error:

def median(numbers):

a = sorted(numbers)

x = len(a)

for number in a:

if x % 2 == 0:

add = a[x/2] + a[(x/2) + 1]

return add / 2.0

else:

add = a[x + 1]

return add / 2.0

print median([1,7,9,74,2])