How do I have the algorithm below to sort my list in opposite direction (right to left) instead of left to right.
Also, how do I make it sort simultaneously or alternatively in both directions? Thanks.

def bubblesort(l):
    for passes in range(len(l)-1, 0, -1):
        for index in range(passes):
            if l[index] < l[index + 1]:
                l[index], l[index + 1] = l[index + 1], l[index]
                print l
    return l


Please use code tags with your code to preserve the indentations. Otherwise the code is very difficult to read and not too many folks will help.

your Python code here


In your code line:
if l[index] < l[index + 1]:
if l[index] > l[index + 1]:
for ascending sort order.

BTW, programmers avoid using the letter l for a variable name, since it looks so much like 1.