Como Bubble classificar uma matriz 2D em Python
>>> blackjackList = [['harsh', '4', 'chips'], ['ahmed', '25', 'chips'], ['yousef', '1003', 'chips'], ['krushangi', '200', 'chips'], ['bombberman', '1202', 'chips']]
>>> def quicksort(arr):
... if len(arr)==0: return []
... if len(arr)==1: return arr
... left = [i for i in arr[1:] if int(i[1])<int(arr[0][1])] # for descending, exchange
... right = [i for i in arr[1:] if int(i[1])>=int(arr[0][1])] # these two values
... return quicksort(left)+[arr[0]]+quicksort(right)
...
>>> quicksort(blackjackList)
[['harsh', '4', 'chips'], ['ahmed', '25', 'chips'], ['krushangi', '200', 'chips'], ['yousef', '1003', 'chips'], ['bombberman', '1202', 'chips']]
Concerned Caiman