• failed to pass the 5th test

Question related to mission Count Inversions

 

My code passed the first 4 tests, but failed in 5th test. I don't know why the result is 4181. Please help! +++++++++++++++++++++++++++++++++++++++++

def count_inversion(sequence):
    """
        Count inversions in a sequence of numbers
    """
    count=0
    for n in range(len(sequence)-1):
        m=1
    #compare a number(n) and the next number(m), and then the next of the next number(m+1)...
        while sequence[n]>sequence[n+m]:
            count+=1
            m+=1
            if n+m==len(sequence):
                break
            else:
                continue        
    return count

++++++++++++++++++++++++++++++++++++++++++++

Here is the 5th test:

Test 5/5

> Your result: 515 Right result: 4181 count_inversion((5,12,-85,-92,-32,-8,1,-34,-55,-74,-44,-63,84,8,65,54,71,90,-81,98,-17,82,-45,-72,37,26,91,97,64,-62,-24,-70,42,56,-67,0,-78,-87,-57,-56,67,-2,11,-16,7,13,-1,-46,-54,16,-4,-14,63,-15,-48,-66,36,46,75,85,-79,-83,-52,73,49,-3,88,-10,60,-21,-75,38,44,2,-89,-65,-96,-22,-76,-31,-58,55,58,14,-47,20,80,-60,93,62,-71,24,45,-64,94,29,-94,-36,57,-23,6,51,15,-5,-53,25,-41,-97,89,-59,66,87,-19,-38,-27,-86,-9,40,18,-93,30,-20,81,34,3,92,77,-25,-49,74,-51,17,41))

8