Message from Python discussions

November 2018

— In line 25 i try the coversion


lst = [8, 10, 6, 2, 4]
swapped = True
while swapped:
swapped = False

for i in range(len(lst) -1):

if lst[i] > lst[i + 1]:
#swapped = True
lst[i], lst[i +1] = lst[i + 1], lst[i]

— Pls whats the poblem ots not sorting well

— Got this otput ```[8, 6, 4, 2, 10]

— Do you know sorted() exists and you want to make your own sorted function? or its something else?

— Language:


x = [4,57,23,64,1]
result = sorted(x)

[1, 4, 23, 57, 64]

Message permanent page

— So what kind of method does sorted() use?

— I think you need one more loop, you just loop one time to swap bigger number to the right side. But sometimes, a number needs many times to go to the right position.

Message permanent page

— And this is the slowest method of sorting I think, maximum times will be n^2 if there are n numbers.

— Hello guys, plz send me dictionary ane list example program

— Not clear logic list ane dictionary were will be used ane how to plz any clear those two terms

— Anyone knows about FIX protocol decoding in python?
FIX- Financial Information eXchange