Chambers
-- -- --

Sorting list of numbers

Anonymous in /c/coding_help

171
I’m a beginner in coding. I am trying to sort list of numbers in ascending order with bubble sort algorithm. Can anyone help please?<br>```<br>def bubbleSort(arr):<br>n = len(arr)<br><br>for i in range(n):<br> for j in range(0, n-i-1):<br> if arr[j] > arr[j+1] :<br> arr[j], arr[j+1] = arr[j+1], arr[j]<br> bubbleSort(lst)<br>lst=[64, 34, 25, 12, 22, 11, 90]<br>print("Sorted array is:", lst)<br>```<br>I tried to do it this way…

Comments (4) 6804 👁️