A = [1,1,4,5,1,4]
P = [0,0,0]
while P[0] < len(A):
    P[1] = P[0]
    while P[1] < len(A):
        if A[P[0]] > A[P[1]]:
            A[P[0]],A[P[1]] = A[P[1]],A[P[0]]
            P[2] += 1
        P[1] += 1
    P[0] += 1
print(f'結果{A} 例外:{P[2]}!')

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: