Skip to content

Instantly share code, notes, and snippets.

@RamonLopezEscudero
Last active July 6, 2016 20:48
Show Gist options
  • Save RamonLopezEscudero/567448e1cbf553feb2b23c12c302b8ab to your computer and use it in GitHub Desktop.
Save RamonLopezEscudero/567448e1cbf553feb2b23c12c302b8ab to your computer and use it in GitHub Desktop.
Ordenamiento de datos por el algoritmo "Bubblesort"
#!/usr/bin/env python
# -*- coding: utf-8 -*-
list = [23, 17, 5, 90, 12, 44, 38, 84, 77, 1]
n = len(list)
for i in range(n - 1):
for j in range(n - 1):
if list[j] < list[j+1]:
pass
else:
temp = list[j+1]
list[j+1] = list[j]
list[j] = temp
print list
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment