/
rnekrasov
/
Python
Обзор
Документация
Войти
/
rnekrasov
/
Python
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
Sorting Algorithms/Bubble_Sorting_Prog.py
14 строк
376 B
arifaisal123
typo corrected
12 май 2023, 16:50
12 май 2023, 16:50
df58d65
Код
Авторство
О чём код?
def bubblesort(list): # Swap the elements to arrange in order for iter_num in range(len(list) - 1, 0, -1): for idx in range(iter_num): if list[idx] > list[idx + 1]: temp = list[idx] list[idx] = list[idx + 1] list[idx + 1] = temp list = [19, 2, 31, 45, 6, 11, 121, 27] bubblesort(list) print(list)