Categories
Code work in Python?
Hello, help me understand the code.
A = [1, 2, 5, 8, 9, 3, 4, 0, 7, 6] j = 5 while A[j] < A[j-1]: A[j], A[j-1] = A[j-1], A[j] j -= 1 print(A)
A[j], A[j-1] = A[j-1], A[j]
Answer the question
In order to leave comments, you need to log in
Swaps values in adjacent positions.
Didn't find what you were looking for?
Ask a Question
731 491 924 answers to any question