You are viewing a single comment's thread. Return to all comments →
from functools import cmp_to_key def bigSorting(unsorted): def sort_rule(a, b): len_a, len_b = len(a), len(b) # compare length first if len_a > len_b: return 1 if len_a < len_b: return -1 # compare string if equal length if a > b: return 1 if a < b: return -1 # if equal string return 0 return sorted(unsorted, key=cmp_to_key(sort_rule))
Seems like cookies are disabled on this browser, please enable them to open this website
Big Sorting
You are viewing a single comment's thread. Return to all comments →