Built-in Functions and List Methods
Learn about the usage of some built-in functions with the list and list methods.
We'll cover the following...
Using built-in functions on lists
Many built-in functions can be used with lists, as shown below:
len(lst) # return number of items in the listmax(lst) # return maximum element in the listmin(lst) # return minimum element in the listsum(lst) # return sum of all elements in the listany(lst) # return True if any element of lst is Trueall(lst) # return True if all elements of lst are Truedel( ) # deletes element or slice or entire listsorted(lst) # return sorted list, lst remains unchangedreversed(lst)# used for reversing lst
Using built-in functions on lists
Let’s ...