Python > Practice Makes Perfect > Median
I get this message when I submit my code:
Oops, try again. Your code did not run to end. Check the console window for errors!
And the console says::
File "python", line 7
SyntaxError: invalid syntax
I can't figure out what the problem is with using else: here.
def median(a): seq = sorted(a) if len(seq) == 1: median = seq elif len(seq) % 2 == 0: median = float(((seq[len(seq)/2] + seq[(len(seq)/2)-1])/2) else: median = int(ses[len(seq)/2]) return median
Any light anyone can shed would be much appreciated.