...

/

Built-in Functions and List Methods

Built-in Functions and List Methods

Learn about the usage of some built-in functions with the list and list methods.

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 list
max(lst) # return maximum element in the list
min(lst) # return minimum element in the list
sum(lst) # return sum of all elements in the list
any(lst) # return True if any element of lst is True
all(lst) # return True if all elements of lst are True
del( ) # deletes element or slice or entire list
sorted(lst) # return sorted list, lst remains unchanged
reversed(lst)# used for reversing lst
Using built-in functions on lists

Let’s ...