Big Sorting: How are same-length strings sorted using lambda with key?

Viewed 350

Here is my code :

def SortingBigIntegers(arr):
    arr.sort(key = lambda x: (len(x), x))

arr = ["54", "724523015759812365462",
        "870112101220845", "8723","6","9","3"]

SortingBigIntegers(arr)

print " ".join(arr)

How are same length strings sorted in this code?

2 Answers
Related