Merge pull request #61 from NamPNQ/improve

Pythonic sort bubble snippet
This commit is contained in:
Angelos Chalaris
2019-08-19 13:51:48 +03:00
committed by GitHub
3 changed files with 14 additions and 9 deletions

View File

@ -6,9 +6,7 @@ def bubble_sort(lst):
for passnum in range(len(lst) - 1, 0, -1):
for i in range(passnum):
if lst[i] > lst[i + 1]:
temp = lst[i]
lst[i] = lst[i + 1]
lst[i + 1] = temp
lst[i], lst[i + 1] = lst[i + 1], lst[i]
```