Skip to main content
Python provides 71 built-in functions that are always available without importing any module. These functions cover common operations like type conversion, iteration, I/O, and more.

Most Commonly Used

These functions are used in almost every Python program:

print()

Output text to the console.
any
Values to print (converted to strings)
str
default:"' '"
String inserted between values
str
default:"'\\n'"
String appended after the last value
file
default:"sys.stdout"
File object to write to

len()

Return the length of an object.
object
required
Any object with a length (string, list, dict, etc.)
int
Number of items in the object

type()

Return the type of an object.
any
required
Object to get the type of
type
The type of the object

range()

Generate a sequence of numbers.
int
required
End of range (exclusive)
int
default:"0"
Start of range (inclusive)
int
default:"1"
Increment between values

input()

Read a string from standard input.
str
default:"''"
Prompt to display before reading input
str
String entered by the user

Type Conversion

Convert between different data types:

int(), float(), str(), bool()

list(), tuple(), set(), dict()

Iteration & Sequences

enumerate()

Add counter to an iterable.

zip()

Combine multiple iterables.

map()

Apply function to every item.

filter()

Filter items based on condition.

sorted()

Return sorted list.

reversed()

Reverse an iterable.

Mathematical Functions

sum(), min(), max()

abs(), round(), pow()

divmod()

Get quotient and remainder.

Object Inspection

isinstance()

Check if object is instance of class.

hasattr(), getattr(), setattr()

Work with object attributes.

dir()

List attributes of an object.

vars()

Return __dict__ attribute of an object.

File Operations

open()

Open a file for reading or writing.
str
required
Path to the file
str
default:"'r'"
Opening mode: ‘r’ (read), ‘w’ (write), ‘a’ (append), ‘b’ (binary)
str
default:"None"
Text encoding (e.g., ‘utf-8’)

Advanced Functions

all(), any()

Test if all or any elements are true.

eval(), exec()

These functions execute arbitrary Python code and should be used with extreme caution, especially with user input.

compile()

Compile source code into code object.

globals(), locals()

Access global and local namespaces.

Special Functions

id()

Return unique identifier for an object.

hash()

Return hash value of an object.

callable()

Check if object is callable.

Complete List

Here are all 71 built-in functions:
  • abs() - Absolute value
  • aiter() - Async iterator
  • all() - Test if all elements are true
  • anext() - Async next
  • any() - Test if any element is true
  • ascii() - ASCII representation
  • bin() - Convert to binary
  • bool() - Convert to boolean
  • breakpoint() - Debugger breakpoint
  • bytearray() - Mutable bytes
  • bytes() - Immutable bytes
  • callable() - Check if callable
  • chr() - Character from code point
  • classmethod() - Class method decorator
  • compile() - Compile source code
  • complex() - Complex number
  • delattr() - Delete attribute
  • dict() - Dictionary
  • dir() - List attributes
  • divmod() - Quotient and remainder
  • enumerate() - Add counter to iterable
  • eval() - Evaluate expression
  • exec() - Execute code
  • filter() - Filter items
  • float() - Convert to float
  • format() - Format value
  • frozenset() - Immutable set
  • getattr() - Get attribute
  • globals() - Global namespace
  • hasattr() - Check for attribute
  • hash() - Hash value
  • help() - Interactive help
  • hex() - Convert to hexadecimal
  • id() - Object identifier
  • input() - Read input
  • int() - Convert to integer
  • isinstance() - Check instance
  • issubclass() - Check subclass
  • iter() - Create iterator
  • len() - Length of object
  • list() - List
  • locals() - Local namespace
  • map() - Map function
  • max() - Maximum value
  • memoryview() - Memory view
  • min() - Minimum value
  • next() - Next item from iterator
  • object() - Base object
  • oct() - Convert to octal
  • open() - Open file
  • ord() - Code point from character
  • pow() - Power
  • print() - Print output
  • property() - Property decorator
  • range() - Range of numbers
  • repr() - String representation
  • reversed() - Reverse iterable
  • round() - Round number
  • set() - Set
  • setattr() - Set attribute
  • slice() - Slice object
  • sorted() - Sort iterable
  • staticmethod() - Static method decorator
  • str() - String
  • sum() - Sum of items
  • super() - Call parent class
  • tuple() - Tuple
  • type() - Type of object
  • vars() - Object dictionary
  • zip() - Combine iterables
  • __import__() - Import module

Best Practices

Use built-in functions instead of loops when possible - They’re optimized in C and much faster.
Avoid eval() and exec() with untrusted input - they can execute arbitrary code.

Built-in Types

Fundamental data types

itertools

Advanced iteration tools

functools

Higher-order function tools