What are built-in functions in Python?
Built-in functions are part of the Python programming language itself and provide essential functionality for various operations.
In Python, there are several built-in functions that are available for immediate use without the need for importing any external libraries.
How many built-in functions are in Python?
In the latest version of Python 3.10, there are 71 built-in functions in the standard library.
They’re used by programmers to perform common tasks such as mathematical calculations, data processing, string manipulation, file handling, etc.
List of All Built-in Functions in Python
Python functions are part of the standard library and are included by default when installing Python.
Let’s take a look at the list of Python built-in functions with examples.
|1||abs()||This function returns the absolute value of the number. Arguments may be integers, floating-point numbers, or objects implementing |
|2||aiter()||This function takes an asynchronous iterator and returns a synchronized iterable for use with that iterator.|
|3||all()||Returns True if each item in an iterable object is true and there are no false elements.|
|4||any()||Returns If even one of the items in an iterable object is true, then true is returned.|
|5||anext()||Return the next item in the asynchronous iterator that was given to you, or the default if the iterator does not contain any items.|
|6||ascii()||The readable version of an object is the one that is returned by this method. This command inserts an escape character in front of any characters that aren’t ASCII.|
|7||bin()||Provides a number in its binary representation and returns it.|
|8||bool()||This function returns either the true or false value of the object.|
|9||breakpoint()||When you use this function, the debugger will take you to the location of the call.|
|10||bytearray()||This function returns an array containing byte values.|
|11||bytes()||It returns an object of type bytes.|
|12||callable()||Returns If the object that was supplied can be called, then this value is True; otherwise, it will return False.|
|13||chr()||This function takes a Unicode code as an argument and returns a character that corresponds to that code.|
|14||classmethod()||Performs the transformation of a method into a class method.|
|15||compile()||Returns the source you specify as an object that is prepared to be carried out in the execution.|
|16||complex()||Provides a number with a complex value as its return value.|
|17||delattr()||Deletes the method or property specified from the object specified if it was specified.|
|18||dict()||This function returns a dictionary (Array)|
|19||dir()||This function will return a list of all the properties and methods that are associated with the object.|
|20||divmod()||When argument1 is divided by argument2, this function returns both the quotient and the remainder.|
|21||enumerate()||This function takes a collection and returns an enumerated object from the collection, similar to a tuple.|
|22||eval()||Performs an evaluation and then executes an expression.|
|23||exec()||It executes the code that you specified (or object)|
|24||filter()||To remove items from an iterable object, use a filter function.|
|25||float()||Return a Python floating point number built from the given number.|
|26||format()||A value that you specify is given a format.|
|27||frozenset()||Gives back an object with the name frozenset.|
|28||getattr()||The value of the attribute that was provided is returned by this function (property or method)|
|29||globals()||This function takes the current global symbol table and returns it as a dictionary.|
|30||hasattr()||Returns True if the given object has the given attribute, method, or property.|
|31||hash()||The value of the object’s hash that was supplied is returned.|
|32||help()||Functions to run the built-in help system.|
|33||hex()||Performs the conversion of an integer to its corresponding value in hexadecimal.|
|34||id()||This function gives back the object’s id.|
|35||input()||This function is accepting input from the user.|
|36||int()||Returns an integer number|
|37||isinstance()||Returns True if the object given is a copy of the object given.|
|38||issubclass()||Python issubclass() returns True if the class you choose is a subclass of the object you choose.|
|39||iter()||Returns an object with an iterator.|
|40||len()||Returns an object’s length.|
|41||list()||Returns a list|
|42||locals()||Returns the current local symbol table’s updated dictionary.|
|43||map()||Returns the iterator with the function you specified applied to each item.|
|44||max()||Returns the largest item in an iterable|
|45||memoryview()||Returns a view object from memory|
|46||min()||Returns the smallest item in an iterable|
|47||next()||Returns the next element in an iterable|
|48||object()||Returns a new object|
|49||oct()||Converts a number to an octal format.|
|50||open()||Numbers are rounded to the nearest integer.|
|51||ord()||Convert an integer that represents the Unicode of the given character to a string.|
|52||pow()||pow() function returns the value of x times the power of y|
|53||print()||Prints to the default printer.|
|54||property()||Gets, sets, deletes a property|
|55||range()||Returns a list of numbers, starting with 0 and going up by 1 each time (by default)|
|56||repr()||Returns a version of an object that can be read.|
|57||reversed()||Returns an iterator that goes in the opposite direction.|
|58||round()||Sort a list and returns it.|
|59||set()||Returns a new set object|
|60||setattr()||Sets an object’s attribute (property or method).|
|61||slice()||Returns a slice object|
|62||sorted()||Sorts a list and returns it.|
|63||staticmethod()||Makes a method a static method.|
|64||str()||Sort a list and return it.|
|65||sum()||Adds up all of the items in an iterator|
|66||super()||Returns an instance of the parent class.|
|67||tuple()||Returns a tuple|
|68||type()||Returns an object’s type.|
|69||vars()||Returns an object’s |
|70||zip()||Returns an iterator, from two or more iterators|
|71||__import__()||Is a function that’s called by the import statement.|
All of these built-in functions come from the Python official documentation about Built-in Functions.
In summary, we’ve learned that the latest Python 3.10 has 71 built-in functions that come with it.
In this tutorial, we’ve talked about what built-in functions are and given a list of all the functions in Python, along with their syntax and some examples of how to use them.
Finally, check out our list of Python Tutorial Topics if you missed any of our previous lessons.
In the next post, “Python Modules“, you’ll find out about the import statement, namespace and scooping, and packages. So go see it as soon as you can!