Hi! so I've been getting all kinds of errors with this one. At first my sorted(lst) wasn't working properly. I'm not sure if thats fixed or not because as i was trying new things to get it to work a new error appeared.
File "python", line 7 else: ^ SyntaxError: invalid syntax
This makes no sense to me since i started getting this error when i changed my code back to my original code which seemed to work, with the exception of the sorting.
Any help is appreciated thanks!
def median(lst): sorted(lst) if len(lst) == 1: return lst elif len(lst) % 2 == 0: return (lst[len(lst)/2] + lst[(len(lst)/2) - 1] / 2.0 else: return lst[len(lst) / 2]