So here is my code for this exercise and it passes, but I’m just curious for a opinion from a more experienced coder. Is there anything that is redundant? Is there a better or more “natural” way to do this?
Let me know I’m eager to learn this well
def median(x): sort_list = sorted(x) first = sort_list[len(x) / 2] second = sort_list[len(x) / 2 - 1] med_even = (first + second) / 2.0 med_odd = first if len(x) % 2 == 0: print med_even return med_even else: print med_odd return med_odd