def median(lis):
if len(sort)==1:
answer= sort[0]
elif len(sort)%2==0:
answer = (sort[len(sort)/2]+sort[1+(len(sort)/2)]/2.0
else :
answer = sort[(len(sort)/2)+1]
return answer

i keep getting he error
File “python”, line 7
else :
SyntaxError: invalid syntax




when getting a syntax error like this, also pay attention to the line above the error message line


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.