Nov-05-2019, 02:59 AM
You are swapping values.
temp = aList[3] #for example, save the value in the 4th position of aList in a temporary variable
aList[3] = aList[3+1] #move the value in the 5th position to the 4th position
alist[3+1] = temp #now put the value that was in the 4th position into the 5th position.
It's called a bubble sort. Here are some related links. The Wikipedia entry is perhaps a tad complex.
https://www.geeksforgeeks.org/bubble-sort/
https://en.wikipedia.org/wiki/Bubble_sort
temp = aList[3] #for example, save the value in the 4th position of aList in a temporary variable
aList[3] = aList[3+1] #move the value in the 5th position to the 4th position
alist[3+1] = temp #now put the value that was in the 4th position into the 5th position.
It's called a bubble sort. Here are some related links. The Wikipedia entry is perhaps a tad complex.
https://www.geeksforgeeks.org/bubble-sort/
https://en.wikipedia.org/wiki/Bubble_sort