This line:
return lis
This is a problem, because you are expecting sort_and_count
to return a tuple containing two values, so when it returns only one value you have a problem with the tuple unpacking in lines like left,c1=sort_and_count(lis[:middle],count)
. This line should return two values, like the last line of that method:
return m,c