.sort() and sorted()
.sort()
.sort()
sorts and changes the original list
Syntax
list.sort(key=str.lower)
key=str.lower will ignore the case of word and is optional
Example
data.sort(key=str.lower)
sorted()
sorted()
returns a sorted list; the original list remains unchanged
Syntax
sorted_list = sorted(unsorted_list, key=str.lower)
Example
data = sorted(data, key=str.lower)