Have integer division and the correct indexes, getting error


#1

def median(seq):
if len(seq)==1:
for n in seq:
median = int(n)
break
else:
seq=seq.sort()
if len(seq)%2==0:
median=(seq[len(seq)/2]\
+seq[(len(seq)/2)-1])/2.0
else:
median=seq[len(seq)/2]
return median

Error Messege: Oops, try again. median([4, 5, 5, 4]) resulted in an error: object of type 'NoneType' has no len()