Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #-*-coding:utf8;-*-
- #qpy:3
- #qpy:console
- #On^2
- from time import sleep
- def bubble_sort(l):
- swap = True
- while swap:
- swap = False
- for i in range(len(l)-1):
- if l[i] > l[i+1]:
- l[i], l[i+1] = l[i+1], l[i]
- swap = True
- list_ = [5, 2, 1, 8, 4, 70, 44]
- bubble_sort(list_)
- print(list_)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement