Update bubble_sort.py

This commit is contained in:
marina 2023-08-02 23:39:04 -07:00 committed by GitHub
parent 2e7f4a9410
commit d357be4e52
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,16 +1,15 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# author: bt3gl
def bubble_sort(list)
def bubble_sort(array)
has_swapped = True
while has_swapped:
has_swapped = False
for i in range(len(lst) - 1):
if lst[i] > lst[i + 1]:
lst[i], lst[i + 1] = lst[i + 1], lst[i]
for i in range(len(array) - 1):
if array[i] > array[i + 1]:
array[i], array[i + 1] = array[i + 1], array[i]
has_swapped = True