newbie question

Classified stephenxbchen at hotmail.com
Sat Dec 14 10:53:59 EST 2002


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)):
		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!



More information about the Python-list mailing list