Created
May 2, 2014 00:23
-
-
Save ricardosiri68/730cca73d5ace90f93f8 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 my_list_sort(l): | |
| """ | |
| *-------------------------------------------------------------------------- | |
| * ordena una lista de forma binaria | |
| *-------------------------------------------------------------------------- | |
| * l: es la lista a ordenar | |
| * @return: retorna la lista ordenada en una etapa | |
| """ | |
| for i in range(len(l)): | |
| try: | |
| if l[i] > l[i + 1]: | |
| l[i], l[i + 1] = l[i + 1], l[i] | |
| return my_list_sort(l) | |
| except IndexError: | |
| pass | |
| return l | |
| print(my_list_sort([4, 9, 6, 7])) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment