Python comes with a set of built-in functions that are always available. You don’t need to import anything to use print(), len(), range(), or sorted(). They’re part of the language itself, and knowing them well saves you from writing code that Python already provides.
This guide lists all 71 built-in functions in Python 3.10 and later, explains what each one does in one line, and then walks through the important ones by category with runnable examples.
Key terms used in this article:
- Built-in function: A function that’s always available in Python without an import, such as
len()orprint(). - Iterable: Any object you can loop over, such as a list, tuple, string, set, dictionary, or range.
- Iterator: An object that produces items one at a time with
next(). Many built-ins, such asmap()andzip(), return iterators. - Callable: Anything you can call with parentheses, such as a function or a class.
Table of contents
- How to see all built-in functions
- Complete list of Python built-in functions
- Math and number functions
- Type conversion functions
- Number system and character functions
- Iteration and sequence functions
- Input and output functions
- Object and type inspection functions
- Attribute functions
- Class and OOP helpers
- Code execution functions
- Scope functions: globals() and locals()
- Memory and binary data functions
- Debugging with breakpoint()
- Async iteration: aiter() and anext()
- Don’t shadow built-in names
- Practice exercises
- Summary
How to see all built-in functions
Built-in functions live in the builtins module. You can list them from Python itself:
Output:
75 ['abs', 'aiter', 'all', 'anext', 'any', 'ascii', 'bin', 'bool', 'breakpoint', 'bytearray']
This count includes a few helpers added by the site module for the interactive shell (exit, quit, copyright, credits, and license) and leaves out __import__. The official documentation lists 71 built-in functions, which are covered below. Use help(name) to read the documentation of any of them, for example help(sorted).
Some entries, such as int, str, list, and range, are actually classes. They’re listed as built-in functions because you call them like functions to create or convert values.
Complete list of Python built-in functions
| Function | Description |
|---|---|
abs(x) | Returns the absolute value of a number |
aiter(async_iterable) | Returns an asynchronous iterator (Python 3.10+) |
all(iterable) | Returns True if every item is truthy (or the iterable is empty) |
anext(async_iterator) | Awaits and returns the next item of an async iterator (Python 3.10+) |
any(iterable) | Returns True if at least one item is truthy |
ascii(obj) | Returns a printable representation with non-ASCII characters escaped |
bin(n) | Converts an integer to a binary string, such as '0b101' |
bool(x) | Converts a value to True or False |
breakpoint() | Pauses the program and opens the debugger |
bytearray(source) | Returns a mutable sequence of bytes |
bytes(source) | Returns an immutable sequence of bytes |
callable(obj) | Returns True if the object can be called |
chr(i) | Returns the character for a Unicode code point |
classmethod(func) | Turns a method into a class method (usually used as @classmethod) |
compile(source, filename, mode) | Compiles source code into a code object |
complex(real, imag) | Creates a complex number |
delattr(obj, name) | Deletes an attribute from an object |
dict() | Creates a dictionary |
dir(obj) | Lists the names (attributes and methods) of an object or the current scope |
divmod(a, b) | Returns the quotient and remainder as a tuple |
enumerate(iterable, start=0) | Returns pairs of (index, item) |
eval(expression) | Evaluates a string as a Python expression and returns the result |
exec(code) | Executes Python code stored in a string or code object |
filter(function, iterable) | Keeps the items for which the function returns a truthy value |
float(x) | Converts a value to a floating-point number |
format(value, spec) | Formats a value using a format specifier |
frozenset(iterable) | Creates an immutable set |
getattr(obj, name, default) | Gets an attribute by name |
globals() | Returns the dictionary of the current global variables |
hasattr(obj, name) | Returns True if the object has the attribute |
hash(obj) | Returns the hash value of an object |
help(obj) | Shows the built-in help system |
hex(n) | Converts an integer to a hexadecimal string |
id(obj) | Returns the unique identity (memory address in CPython) of an object |
input(prompt) | Reads a line of text from the user |
int(x, base=10) | Converts a value to an integer |
isinstance(obj, classinfo) | Checks whether an object is an instance of a class |
issubclass(cls, classinfo) | Checks whether a class is a subclass of another |
iter(obj) | Returns an iterator for an object |
len(obj) | Returns the number of items in an object |
list(iterable) | Creates a list |
locals() | Returns a dictionary of the current local variables |
map(function, iterable, ...) | Applies a function to every item |
max(iterable) | Returns the largest item |
memoryview(obj) | Returns a memory view of a bytes-like object without copying it |
min(iterable) | Returns the smallest item |
next(iterator, default) | Returns the next item from an iterator |
object() | Returns a new featureless object, the base of all classes |
oct(n) | Converts an integer to an octal string |
open(file, mode) | Opens a file and returns a file object |
ord(c) | Returns the Unicode code point of a character |
pow(base, exp, mod) | Returns base to the power exp, optionally modulo mod |
print(*objects) | Prints objects to the screen or a file |
property(fget, fset) | Creates a managed attribute (usually used as @property) |
range(start, stop, step) | Returns an immutable sequence of numbers |
repr(obj) | Returns the developer-friendly string representation |
reversed(seq) | Returns a reverse iterator |
round(number, ndigits) | Rounds a number |
set(iterable) | Creates a set |
setattr(obj, name, value) | Sets an attribute by name |
slice(start, stop, step) | Creates a slice object |
sorted(iterable, key, reverse) | Returns a new sorted list |
staticmethod(func) | Turns a method into a static method (usually used as @staticmethod) |
str(obj) | Converts a value to a string |
sum(iterable, start=0) | Adds up the items |
super() | Gives access to methods of a parent class |
tuple(iterable) | Creates a tuple |
type(obj) | Returns the type of an object (or creates a new class with three arguments) |
vars(obj) | Returns the __dict__ of an object |
zip(*iterables) | Combines several iterables item by item |
__import__(name) | Imports a module (used internally by the import statement) |
Math and number functions
abs(), round(), pow(), divmod(), sum(), min(), and max() cover everyday calculations.
Output:
7.5 3.14 1200.0 1024 24 (3, 2) 60 160 1 9
round() uses banker’s rounding
round() rounds halves to the nearest even number. This avoids bias in large datasets, but it surprises many beginners:
Output:
0 2 2 4
min() and max() with key and default
Output:
banana fig 0 mango
Type conversion functions
These functions create values of a type or convert from one type to another: int(), float(), str(), bool(), complex(), list(), tuple(), set(), frozenset(), dict(), bytes(), and bytearray().
Output:
43 9 255 10 3.5 100% False False False True (2+3j)
Output:
['a', 'b', 'c']
(1, 2, 3)
{1, 2, 3}
{'a': 1, 'b': 2}
{'name': 'Jessa', 'age': 28}
frozenset({1, 2})
b'hi'
See Python Casting: Type Conversion and Type Casting for more detail.
Number system and character functions
Output:
0b1010 0o12 0xff 65 A 8364 € 11111111 1,234,567.89 'caf\xe9'
Iteration and sequence functions
These functions work with any iterable and are used constantly in real code.
len(), range(), enumerate(), and zip()
Output:
3 [2, 5, 8] 1 apple 2 banana 3 cherry apple: $1.2 banana: $0.5 cherry: $3.0
zip() stops at the shortest iterable. Pass strict=True (Python 3.10+) to raise an error when the lengths differ.
Output:
[('Jessa', 28), ('Kelly', 31)]
Error: zip() argument 2 is shorter than argument 1
sorted() and reversed()
sorted() returns a new list and works on any iterable. reversed() returns an iterator over a sequence in reverse order.
Output:
[1, 2, 5, 9] [9, 5, 2, 1] [5, 2, 9, 1] ['h', 'n', 'o', 'p', 't', 'y'] [1, 9, 2, 5] olleh
all() and any()
Output:
True True True False
map() and filter()
Output:
[3, 8, 15] [1, 3, 5] [1, 'a', [2]]
Passing None to filter() keeps only truthy items. For details, see Lambda Functions in Python.
iter() and next()
Output:
red green no more items
slice()
A slice object stores start, stop, and step, so you can reuse the same slice:
Output:
[10, 20, 30] [10, 30, 50] Pyt
Input and output functions
print(), input(), and open() handle communication with users and files.
Output:
a b c a-b-c no newline | same line Saved with print()
input() always returns a string, so convert it when you need a number:
See Python Input: Take Input from User for more.
Object and type inspection functions
These functions let you inspect objects at runtime: type(), isinstance(), issubclass(), id(), hash(), callable(), dir(), vars(), repr(), and help().
Output:
<class 'list'> list True True True True False True 'text' text
Prefer isinstance() over type(x) == SomeType, because isinstance() also accepts subclasses.
dir() and vars()
Output:
{'title': 'Python 101', 'pages': 250}
['pages', 'title']
Attribute functions
getattr(), setattr(), hasattr(), and delattr() work with attributes whose names are stored in strings:
Output:
False 8000 True False
Class and OOP helpers
classmethod(), staticmethod(), property(), super(), and object() are mostly used as decorators or inside classes:
Output:
Rex the beagle Woof 1 False
Code execution functions
eval() evaluates an expression stored in a string, exec() executes statements, and compile() turns source code into a code object.
Output:
14 10
Security warning: Never pass user input to eval() or exec(). They run any code, including code that deletes files or reads secrets. To safely convert a string such as "[1, 2, 3]" into a Python object, use ast.literal_eval() instead.
Output:
[1, 2, {'a': 3}]
Scope functions: globals() and locals()
Output:
{'count': 3}
True
Memory and binary data functions
bytes(), bytearray(), and memoryview() work with raw binary data:
Output:
bytearray(b'Hello') b'ell'
Debugging with breakpoint()
breakpoint() stops your program and opens the pdb debugger at that line, so you can inspect variables, step through code, and continue (type c) or quit (type q).
Async iteration: aiter() and anext()
aiter() and anext() are the asynchronous versions of iter() and next(), used with async for and async generators:
Output:
3 2 1 done
Don’t shadow built-in names
Built-in names aren’t reserved keywords, so you can accidentally overwrite them with your own variables. After that, the built-in function is unavailable in that scope:
Output:
Error: 'list' object is not callable ['a', 'b', 'c']
Avoid naming variables list, dict, str, id, input, sum, max, min, type, or filter. Use descriptive names such as items, user_id, or total instead.
Practice exercises
Exercise 1: Given a list of numbers as strings, convert them to integers and print their sum, minimum, maximum, and average rounded to 2 decimals.
Output:
75 5 33 15.0
Exercise 2: Combine two lists into a dictionary and print the key with the highest value.
Output:
{'Jessa': 82, 'Kelly': 95, 'Emma': 77}
Kelly
Exercise 3: Print each character of a word with its Unicode code point in binary.
Output:
1 H 72 0b1001000 2 i 105 0b1101001 3 ! 33 0b100001
Summary
- Python has 71 built-in functions that are available without importing anything.
- Use
abs(),round(),pow(),divmod(),sum(),min(), andmax()for math. - Use
int(),float(),str(),bool(),list(),tuple(),set(), anddict()to convert and create values. - Use
len(),range(),enumerate(),zip(),sorted(),reversed(),map(),filter(),all(), andany()to work with iterables. - Use
type(),isinstance(),dir(),vars(),getattr(), andhasattr()to inspect objects. - Avoid
eval()andexec()on untrusted input, and never shadow built-in names with your own variables.
Also, See:

Leave a Reply