What does the line "x = -1" do in this code

https://www.codecademy.com/code-challenges/code-challenge-top-score-sorter-python

def score_sorter(array, top_score): # Write your code here x = 0 while (x < (len(array) - 1)): ele_1 = array[x] ele_2 = array[x+1] if ele_1 > ele_2: temp = array[x] array[x] = array[x+1] array[x+1] = temp x = -1 x += 1 return array one = [235,62,36235,64742,6748,236482,412256469,5,635856,845643,1356,84,54684,56,3458,456,36547,4,34646,4,563,46,6,7,45743,-2] two = [29187351098274025938475]

My question is about the line of code “x = -1”
Does anybody know why this is needed?
This is my first post, not sure if I’m formating it correctly

Hello.
It, when coupled with the following x += 1, resets x to 0 so the loop starts again.

And your code formatted perfectly.