Created
October 24, 2018 20:47
-
-
Save arzon94/71b83ec179575e3e37b8d247472b2f8f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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