Good afternoon. I have been skirting around this problem for a while. I felt I was getting close using the append() function but dropped that when I realised the answer was just one number. So simplified it to the code you see below. I THINK this should work but I cannot get it to run as the following message comes up:
" File "python", line 5
SyntaxError: invalid syntax "
Now this maybe one of those times I have overlooked the obvious. But please have a look and tell me where I am in error. Thank you.
The "else" phrase is for the events that have just one digit in ie not divisible by two with an integer remaining.
x=sorted(x) if len(x)%2==1: x=(len(x/2.0)-1 elif len(x)%2==0: x=((len(x)/2.0)-1)+(len(x/2.0))/2.0 else: return x print median