newbie question

Mel Wilson mwilson at the-wire.com
Sat Dec 14 12:22:40 EST 2002


In article <pan.2002.12.14.15.56.07.271399 at hotmail.com>,
"Classified" <stephenxbchen at hotmail.com> wrote:
>Hi, I'm new to python and I encounter a problem...
>I'm frustrated because the following code won't work...
>a=[('a',1),('c',5),('k',5),('o',3), ('i',3)]
>for i in range(0, len(a)-1):
>    for j in range(1, len(a)):
                    ^
       i ? ---------|

>        if a[i][1]>a[j][1]:
>            a[i],a[j]=a[j],a[i]
>print a
>it appears that the bubble sort will not sort a...
>I guess I must have made a stupid mistake somewhere...
>I'm a newbie, I don't know how to use the debugger...
>thanks to whoever that can help me!

        Regards.        Mel.



More information about the Python-list mailing list