20 Essential Python Built-in Functions Explained | Memorabit

20 Essential Python Built-in Functions Explained

Python's built-in functions are the fundamental tools for any programmer. When working with data, the need to understand its characteristics quickly arises. For instance, determining the size of a collection is often the first step, and the len() function provides this by returning the length or number of items of an object. Similarly, checking if all elements within an iterable meet a certain condition is crucial, a task handled by the all() function, which returns True if all elements are true or if the iterable is empty. When iterating through data, pairing elements with their index can be immensely helpful, and the enumerate() function returns an enumerate object to facilitate this.

Every function listed here can be saved with Memorabit, which sends it as a reminder at an unexpected moment. The full list follows.

Term Meaning
abs() Returns the absolute value of a number.
all() Returns True if all elements of the iterable are true or if the iterable is empty.
any() Returns True if any element of the iterable is true.
enumerate() Returns an enumerate object.
filter() Constructs an iterator from elements of an iterable for which a function is true.
input() Reads a line from input, converts it to a string stripping a trailing newline, and returns it.
isinstance() Returns True if the object argument is an instance or subclass of the classinfo argument.
len() Returns the length or number of items of an object.
map() Returns an iterator that applies a function to every item of an iterable, yielding the results.
max() Returns the largest item in an iterable or the largest of two or more arguments.
min() Returns the smallest item in an iterable or the smallest of two or more arguments.
open() Opens a file and returns a corresponding file object.
print() Prints objects to the text stream file, separated by sep and followed by end.
range() Represents an immutable sequence type rather than a function.
reversed() Returns a reverse iterator.
round() Returns a number rounded to ndigits precision after the decimal point.
sorted() Returns a new sorted list from the items in an iterable.
sum() Sums start and the items of an iterable from left to right and returns the total.
type() Returns the type of an object when called with one argument.
zip() Iterates over several iterables in parallel, producing tuples with an item from each one.