Python built-in functions
Python Built-in Functions
As of Python 3.11.2, there are 71 built-in functions in Python. Below is a list of built-in functions −
Number | Function and Description |
---|---|
1 | abs() Returns the absolute value of a number |
2 | aiter() Returns an asynchronous iterator over an asynchronous iterable |
3 | all() Returns true if all elements in the iterable are true |
4 | anext() Returns the next item from the given asynchronous iterator. |
5 | any() Checks if any element in an iterable is true. |
6 | ascii() Returns a string containing a printable representation. |
7 | bin() Converts an integer to a binary string. |
8 | bool() Converts a value to a boolean. |
9 | breakpoint() This function puts you into the debugger and calls sys.breakpointhook(). |
10 | bytearray() Returns an array of the specified size of bytes. |
11 | bytes() Returns an immutable bytes object. |
12 | callable() Checks if an object is callable. |
13 | chr() Returns a character (string) from an integer. |
14 | classmethod() Returns a class method for a given function. |
15 | compile() Returns a code object. |
16 | complex() Creates a complex number. |
17 | delattr() Deletes attributes from an object. |
18 | dict() Creates a dictionary. |
19 | dir() Attempts to return an object’s attributes. |
20 | divmod() Returns a tuple of the quotient and remainder. |
21 | enumerate() Returns an enumeration object. |
22 | eval() Executes code within a program. |
23 | exec() Executes a dynamically created program |
24 | filter() Constructs an iterator from a true value |
25 | float() Returns a floating-point number from a number or string |
26 | format() Returns a formatted representation of a value |
27 | frozenset() Returns an immutable frozenset object. |
28 | getattr() Returns the value of a named attribute on an object. |
29 | globals() Returns the dictionary of the current global symbol table. |
30 | hasattr() Returns whether an object has an attribute with the specified name. |
31 | hash() Returns the hash value of an object. |
32 | help() Invokes the built-in help system. |
33 | hex() Converts an integer to hexadecimal. |
34 | id() Returns the object’s ID. |
35 | input() Reads and returns a string. |
36 | int() Converts a number or string to an integer. |
37 | isinstance() Checks if an object is an instance of a class. |
38 | issubclass() Checks if a class is a subclass of another class. |
39 | iter() Returns an iterator. |
40 | len() Returns the length of an object. |
41 | list() Creates a list in Python. |
42 | locals() Returns the dictionary of the current local symbol table. |
43 | map() Applies a function and returns a list. |
44 | max() Returns the largest item. |
45 | memoryview() Returns a memory view of its argument. |
46 | min() Returns the minimum value. |
47 | next() Get the next item from the iterator. |
48 | object() Creates a featureless object. |
49 | oct() Returns the octal representation of an integer. |
50 | open() Returns a file object. |
51 | ord() Returns the integer value of a Unicode character. |
52 | pow() Returns a number raised to a power. |
53 | print() Prints the given object. |
54 | property() Returns a property. |
55 | range() Returns a sequence of integers. |
56 | repr() Returns a printable representation of an object. |
57 | reversed() Returns a reversed iterator for a sequence. |
58 | round() Rounds a number to the specified number of decimal places. |
59 | set() Constructs and returns a set. |
60 | setattr() Sets an attribute value of an object. |
61 | slice() Returns a slice object. |
62 | sorted() Returns a sorted list from a given iterable. |
63 | staticmethod() Converts a method to a static method. |
64 | str() Returns a string version of an object. |
65 | sum() Adds items to an iterable. |
66 | super() Returns a proxy object for the base class. |
67 | tuple() Returns a tuple. |
68 | type() Returns the type of an object. |
69 | vars() Returns the dict attributes. |
70 | zip() Returns an iterator of tuples. |
71 | import() Function called by the import statement. |
Built-in Mathematical Functions
The following mathematical functions are built into the Python interpreter, so you do not need to import them from any module.
-
abs() function
-
max() function
-
min() function
-
pow() function
-
round() function
-
sum() function