Python Built-in Functions

About This Index
This page is the Python Built-in Functions index for the tutorial track. Each row links to a full guide with syntax, parameters, return value, three runnable examples, and FAQs. Every example is a complete Python 3 script with fixed data, so you can paste it into a file and run it.
Learn what a built-in is on the Built-ins hub. Use this page when you need a specific function such as print(), len(), or sorted().
Some entries, such as int(), str(), list(), and dict(), are really built-in types (classes). You call them exactly like functions, which is why Python lists them here too. A few entries are newer than Python 3.8: breakpoint() (3.7), aiter() and anext() (3.10), and frozendict() and sentinel() (new in 3.15).
How to Call a Built-in Function
Write the name, then the arguments in parentheses. No import and no dot notation are needed:
scores = [72, 95, 88]
print(len(scores)) # 3
print(max(scores)) # 95
print(sorted(scores)) # [72, 88, 95]
print(int("42") + 1) # 43
print(round(3.14159, 2)) # 3.14 Python Built-in Functions Table
All function guides in this Python tutorial series (73 tutorials), grouped by purpose.
Math and numbers
14 functionsArithmetic helpers and number types: absolute value, powers, rounding, totals, minimum and maximum, base conversion, and building int, float, complex, and bool values.
| Function | Description | Tutorial |
|---|---|---|
abs() | Absolute value of a number: distance from zero. | Try it |
divmod() | Quotient and remainder of a division in one call. | Try it |
pow() | Raise a number to a power, with an optional modulus. | Try it |
round() | Round a number to a given number of decimals. | Try it |
sum() | Add up the numbers in an iterable. | Try it |
min() | Smallest item of an iterable or of several arguments. | Try it |
max() | Largest item of an iterable or of several arguments. | Try it |
bin() | Binary string of an integer, prefixed with 0b. | Try it |
oct() | Octal string of an integer, prefixed with 0o. | Try it |
hex() | Hexadecimal string of an integer, prefixed with 0x. | Try it |
int() | Convert a number or string to an integer. | Try it |
float() | Convert a number or string to a floating-point number. | Try it |
complex() | Create a complex number from parts or a string. | Try it |
bool() | Convert a value to True or False using truthiness. | Try it |
Text, bytes, and console
11 functionsTurn values into text, read and print on the console, convert between characters and code points, and work with raw bytes.
| Function | Description | Tutorial |
|---|---|---|
ascii() | repr() of an object with non-ASCII characters escaped. | Try it |
chr() | Character for a Unicode code point number. | Try it |
ord() | Unicode code point number of a single character. | Try it |
repr() | Developer-friendly string representation of an object. | Try it |
str() | Convert any value to text, or decode bytes. | Try it |
format() | Format one value with a format spec like ".2f". | Try it |
print() | Write values to the console or another text stream. | Try it |
input() | Read a line of text typed by the user. | Try it |
bytes() | Create an immutable sequence of byte values. | Try it |
bytearray() | Create a mutable, resizable sequence of bytes. | Try it |
memoryview() | Zero-copy view of the memory of a bytes-like object. | Try it |
Collections and sequences
13 functionsBuild lists, tuples, sets, and dicts, count items, make ranges and slices, and sort, reverse, number, or pair up sequences.
| Function | Description | Tutorial |
|---|---|---|
list() | Build a new list from any iterable. | Try it |
tuple() | Build an immutable sequence from an iterable. | Try it |
set() | Build an unordered collection of unique items. | Try it |
frozenset() | Build an immutable, hashable set. | Try it |
frozendict() | Immutable, hashable mapping (new in Python 3.15). | Try it |
dict() | Build a dictionary of key/value pairs. | Try it |
slice() | Create a reusable slice object like [start:stop:step]. | Try it |
range() | Lazy sequence of integers for loops and indexing. | Try it |
sorted() | Return a new sorted list from any iterable. | Try it |
reversed() | Iterate over a sequence from the last item to the first. | Try it |
enumerate() | Loop with a counter: (index, item) pairs. | Try it |
zip() | Pair up items from several iterables. | Try it |
len() | Number of items in a sequence or collection. | Try it |
Iteration and functional tools
8 functionsGet iterators and step through them, including the async versions, transform and filter items lazily, and test whether all or any items are true.
| Function | Description | Tutorial |
|---|---|---|
iter() | Get an iterator from an iterable, or from a callable and a sentinel. | Try it |
next() | Get the next item from an iterator, with an optional default. | Try it |
aiter() | Get an asynchronous iterator (Python 3.10+). | Try it |
anext() | Await the next item of an async iterator (Python 3.10+). | Try it |
map() | Apply a function to every item, lazily. | Try it |
filter() | Keep only the items that pass a test, lazily. | Try it |
all() | True if every item is truthy (or the iterable is empty). | Try it |
any() | True if at least one item is truthy. | Try it |
Objects and classes
11 functionsCheck types and class relationships, create classes on the fly, call parent methods, define managed attributes and alternative methods, and inspect identity and hashes.
| Function | Description | Tutorial |
|---|---|---|
object() | The base class of every Python class. | Try it |
type() | Get the class of an object, or create a new class. | Try it |
isinstance() | Check whether an object is an instance of a class. | Try it |
issubclass() | Check whether a class inherits from another class. | Try it |
callable() | Check whether an object can be called like a function. | Try it |
super() | Call a method from the parent class. | Try it |
property() | Turn methods into a managed attribute. | Try it |
classmethod() | Define a method that receives the class (cls). | Try it |
staticmethod() | Define a method that receives neither self nor cls. | Try it |
hash() | Get the hash value used by dicts and sets. | Try it |
id() | Get an object's identity, unique while it is alive. | Try it |
Attributes and introspection
9 functionsRead, set, test, and delete attributes by name, list the names an object or scope has, and open the built-in help system.
| Function | Description | Tutorial |
|---|---|---|
getattr() | Read an attribute by name, with an optional default. | Try it |
setattr() | Set an attribute by name. | Try it |
hasattr() | Check whether an object has an attribute. | Try it |
delattr() | Delete an attribute by name. | Try it |
vars() | Get the __dict__ of an object, module, or class. | Try it |
dir() | List the attribute names of an object or scope. | Try it |
globals() | Get the dictionary of module-level names. | Try it |
locals() | Get a dictionary of the current local variables. | Try it |
help() | Show built-in documentation for an object. | Try it |
Code execution, files, and system
7 functionsEvaluate and run code from strings, compile code objects, open files, start the debugger, import modules by name, and create sentinel values.
| Function | Description | Tutorial |
|---|---|---|
eval() | Evaluate a string as a Python expression. | Try it |
exec() | Execute a string of Python statements. | Try it |
compile() | Turn source text into a code object. | Try it |
open() | Open a file for reading or writing. | Try it |
breakpoint() | Pause in the debugger (Python 3.7+). | Try it |
__import__() | The function behind the import statement. | Try it |
sentinel() | Create a unique marker value (new in Python 3.15). | Try it |
Frequently Asked Questions
Start with abs()
Open the first guide in the list and work your way through the built-ins.
14 people found this page helpful
