Python Built-in Functions 📚
Built-in Functions Reference
Python comes with over 60 built-in functions that are always available. These are the most commonly used ones.
✨ Most Commonly Used
Type Conversion
python
int("42") # 42
float("3.14") # 3.14
str(100) # "100"
bool(0) # False
list("abc") # ['a', 'b', 'c']Math
python
abs(-5) # 5
max([1, 5, 3]) # 5
min([1, 5, 3]) # 1
sum([1, 2, 3]) # 6
round(3.14159, 2) # 3.14Iterables
python
len([1, 2, 3]) # 3
sorted([3, 1, 2]) # [1, 2, 3]
reversed([1, 2, 3])
enumerate(["a", "b"])
zip([1, 2], ["a", "b"])📋 Complete Function Reference
| Function | Description |
|---|---|
| abs() | Returns the absolute value of a number |
| all() | Returns True if all items in an iterable object are true |
| any() | Returns True if any item in an iterable object is true |
| bin() | Returns the binary version of a number |
| bool() | Returns the boolean value of the specified object |
| dict() | Returns a dictionary |
| enumerate() | Takes a collection and returns it as an enumerate object with index |
| filter() | Use a filter function to exclude items in an iterable object |
| float() | Returns a floating point number |
| int() | Returns an integer number |
| input() | Allowing user input |
| len() | Returns the length of an object |
| list() | Returns a list |
| map() | Execute a specified function for each item in an iterable |
| max() | Returns the largest item in an iterable |
| min() | Returns the smallest item in an iterable |
| print() | Prints to the standard output device |
| range() | Returns a sequence of numbers, starting from 0 and increments by 1 (by default) |
| round() | Rounds a number |
| sorted() | Returns a sorted list |
| str() | Returns a string object |
| sum() | Sums the items of an iterator |
| type() | Returns the type of an object |
| zip() | Returns an iterator of tuples from combining iterables |
💡 Did You Know?
Python has over 60 built-in functions. You can see all of them by running dir(__builtins__) in your Python interpreter.