Skip to content

Python3 Built-in Functions

Python provides a large number of built-in functions that can be used directly without importing any libraries. These functions cover common scenarios such as data type conversion, mathematical computation, iteration operations, and reflection mechanisms, and are essential basic tools for every Python beginner.

  • Reduce code: one line does the work of many (e.g., sum(), max())
  • Improve readability: clear semantics, more readable than hand-written logic
  • Better performance: implemented in C at the bottom, usually faster than Python loops
  • Numerical computation: abs(), round(), min(), max(), sum()

  • Type conversion: int(), float(), str(), list(), tuple()

  • Iteration & functional: map(), filter(), zip(), enumerate()

  • Reflection & objects: type(), isinstance(), getattr(), setattr()

  • Input/Output: print(), input(), open()

# Sum
sum([1, 2, 3])  # 6

# Maximum
max([3, 6, 2])  # 6

# Type conversion
int("123")      # 123

# Enumerate
for i, v in enumerate(['a', 'b']):
    print(i, v)

# map
list(map(lambda x: x * 2, [1,2,3]))  # [2,4,6]

Built-in Functions
abs() dict() help() min() setattr()
all() dir() hex() next() slice()
any() divmod() id() object() sorted()
ascii() enumerate() input() oct() staticmethod()
bin() eval() int() open() str()
bool() exec() isinstance() ord() sum()
bytearray() filter() issubclass() pow() super()
bytes() float() iter() print() tuple()
callable() format() len() property() type()
chr() frozenset() list() range() vars()
classmethod() getattr() locals() repr() zip()
compile() globals() map() reversed() __import__()
complex() hasattr() max() round() reload()
delattr() hash() memoryview() set()