my_list.sort()) • sorted(): a built-in function, consumes an iterable and returns a new sorted list SORT X SORTED 21 >>> L = ['grape', 'Cherry', 'strawberry', 'date', 'banana'] >>> sorted(L) ['Cherry', 'banana', 'date', 'grape', 'strawberry']
>>> sorted(L, key=str.lower) # case insensitive ['banana', 'Cherry', 'date', 'grape', 'strawberry']
>>> sorted(L, key=len) # sort by word length ['date', 'grape', 'Cherry', 'banana', 'strawberry']
>>> sorted(L, key=lambda s:list(reversed(s))) # reverse word ['banana', 'grape', 'date', 'strawberry', 'Cherry']