Код: Выделить всё
lst = [6, 3, 0]
keepGoing = True
while keepGoing == True:
for element in lst:
thiselem = element
if lst[lst.index(thiselem)] != lst[-1]:
nextelem = lst[lst.index(thiselem) + 1]
if int(thiselem) > int(nextelem):
lst[lst.index(thiselem) + 1] = thiselem
lst[lst.index(thiselem)] = nextelem
print(lst)
Код: Выделить всё
[0,6,3]
Я хотел, чтобы сортировка отображалась так, как есть...
Код: Выделить всё
[3,6,0]
[3,0,6]
[0,3,6]
Подробнее здесь: https://stackoverflow.com/questions/786 ... oes-python