Skip to content

Instantly share code, notes, and snippets.

@arzon94
Created October 24, 2018 20:47
Show Gist options
  • Select an option

  • Save arzon94/71b83ec179575e3e37b8d247472b2f8f to your computer and use it in GitHub Desktop.

Select an option

Save arzon94/71b83ec179575e3e37b8d247472b2f8f to your computer and use it in GitHub Desktop.
def sort(arr):
# corrected = False
sorted = False
while not sorted:
sorted = True
for i in range(len(arr)-1):
if arr[i] > arr[i+1]:
sorted = False
arr[i], arr[i+1] = arr[i+1], arr[i]
return arr
# print(sort([1,2,3,4,5,6]))
# print(sort([4,2,3,1,6,5]))
# print(sort([6,5,4,3,2,1]))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment