in [ ] out[ ][ sort has few options that will occasionally come in handy one is the ability to pass secondary sort keyi function that produces value to use to sort the objects for examplewe could sort collection of strings by their lengthsin [ ] ['saw''small''he''foxes''six'in [ ] sort(key=lenin [ ] out[ ]['he''saw''six''small''foxes'binary search and maintaining sorted list the built-in bisect module implements binary-search and insertion into sorted list bisect bisect finds the location where an element should be inserted to keep it sortedwhile bisect insort actually inserts the element into that locationin [ ]import bisect in [ ] [ in [ ]bisect bisect( out[ ] in [ ]bisect bisect( out[ ] in [ ]bisect insort( in [ ] out[ ][ the bisect module functions do not check whether the list is sorted as doing so would be computationally expensive thususing them with an unsorted list will succeed without error but may lead to incorrect results slicing you can select sections of list-like types (arraystuplesnumpy arraysby using slice notationwhich in its basic form consists of start:stop passed to the indexing operator []in [ ]seq [ in [ ]seq[ : out[ ][ slices can also be assigned to with sequencein [ ]seq[ : [ appendixpython language essentials www it-ebooks info