For the example median([4, 5, 5, 4]) Codecademy says it returns 4 but when I run it on the Python I have installed on my computer it says 4.5 which is the right answer. Any idea what is going on? I am at a complete loss and what to move on to learn more about Python! Haha.
def median(numbers): sorted_list = sorted(numbers) midpoint = len(numbers) // 2 if len(numbers) % 2 == 1: return sorted_list[midpoint] else: return (sorted_list[midpoint] + sorted_list[midpoint - 1]) / 2 print(median([4, 5, 5, 4]))