Skip to content

Instantly share code, notes, and snippets.

@buranmert
Created April 9, 2015 19:18
Show Gist options
  • Save buranmert/b2d2b8037ca5b806382a to your computer and use it in GitHub Desktop.
Save buranmert/b2d2b8037ca5b806382a to your computer and use it in GitHub Desktop.
Simple sorting in Python
array = [1,2,3]
for x in range(len(array)-1):
indexToSwap = x
for y in range(x+1, len(array)):
if array[indexToSwap] > array[y]:
indexToSwap = y
array[x], array[indexToSwap] = array[indexToSwap], array[x]
print array
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment