Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 1

###################### 6.4.

1 Custom sorting def compareNumOfChars(string1, string2): return cmp(len(string1), len(string2)) wordList = ['Python', 'is', 'better', 'than', 'C'] wordList.sort() print wordList wordList = ['Python', 'is', 'better', 'than', 'C'] wordList.sort(compareNumOfChars) print wordList

You might also like