Practice makes perfect: Median
I am unsure what this error message means and where my code is wrong:
"Oops, try again. median([4, 5, 5, 4]) resulted in an error: unsupported operand type(s) for /: 'tuple' and 'int'"
As with everyone else, I expected my code just to run without problems.
def median(numbers): new_list = sorted(numbers) if (len(numbers) % 2) == 0: return (new_list[len(new_list)/2], + new_list[(len(new_list)/2) - 1])/2 else: return new_list[(len(new_list)/2) - 1]