Quantcast
Channel: Форум программистов и сисадминов Киберфорум
Viewing all articles
Browse latest Browse all 514817

Не работает сортировка "пузырком" - Python

$
0
0
Добрый вечер! Сделал простую сортировку, а она не работает.
В чем проблема?

:

# put your python code here

def bubble_sort(num):
    last_el = len(num)-1
    for x in range(0,last_el):
        for i in range(0,last_el):
            if num[x] > num[x+1]:
                num[x], num[x+1] = num[x+1], num[x]
                print('sort:\n',num)
               

num = [int(input()),int(input()),int(input())]

bubble_sort(num)


Viewing all articles
Browse latest Browse all 514817

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>