I've written the code below and it passes when i use it in IDLE with any combination of numbers, however I am getting an error median([1]) returned -0.5 instead of 1 in codecademy.

Anyone have any help as to why it isn't passing or what I have missed?

numbers = []

def median(numbers):

new = []

result = 0

new = sorted(numbers)

if len(numbers)/2 != 0:

result = len(new) / 2

return new[result]

else:

result = ((len(new) / 2 ) + (len(new) / 2 - 1)) / 2.0

return result

median(numbers)