update bubble_sort

use tuple
This commit is contained in:
Lt-grint
2019-02-27 11:18:58 +08:00
committed by GitHub
parent 02a67bbb76
commit 0a961d18b0

View File

@ -77,9 +77,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]
```
<details><summary>View Examples</summary>