here is another example for case-insensitive sortingnote the difference between the list sort(method and the sorted built-in function list sort() method of the list objectsorts the existing instance of list without copying it this method changes the target object and returns none it is an important convention in python that functions or methods that change the object return none to make it clear that no new object was created and that the object itself was changed on the other handthe sorted built-in function returns new list it actually accepts any iterable object as an argumentbut it will always return list both list sort and sorted take two optional keyword arguments as key simple way to sort more complex structures is to use the index of the element to sort using the lambda operatorfor examplehere we have sorted the items by price