ZagirovAA
2/20/2019 - 2:43 PM

Bubble sorting algorithm implementaion

Bubble sorting algorithm implementaion

def bubble(lst):
  changed = False
  while changed:
    for i in range(len(lst)-1):
      if lst[i] > lst[i+1]:
        lst[i], lst[i+1] = lst[i+1], lst[i]
        changed = True
 return lst

my_list = [10, 35, 25, 8, 4, 28, 69, 1]
print(bubble(my_list))