Skip to content

Python Built-In Functions

Python comes built-in with a number of functions that are always available unless explicitly overwritten. The table below provides all functions available in Python 3, as well as dedicated tutorials.

This table provides all the built-in Python functions, including descriptions of what they do. The table is sortable by the function's starting letter and by its type (i.e., function, class, decorator, or awaitable).
Function NameCodeDescriptionTutorial
Aabs()Functionabs(x)Returns the absolute value of an integer, floating point value, or an object that implements abs(). If the argument is a complex number, the magnitude of that number is returned. for abs()Arithmetic
Aaiter()Functionaiter(async_iterable)Returns an asynchronous iterator for an asynchronous iterable.Aync Function
Aall()Functionall(iterable)Returns True if all the elements in the passed in iterable are true (or if the iterable is empty).Comparisons
Aany()Functionany(iterable)Returns True is any of the elements in the passed-in iterable are True, otherwise return False. If the iterable if empty, return False.Comparisons
Aanext()Awaitableanext(async_iterator), anext(async_iterator, default)When awaited, return the next item from the given asynchronous iterator, or default if given and the iterator is exhausted.Aync Function
Aascii()Functionascii(object)Returns a string containing the printable representation of an object but escapes the non-ASCII characters.String Conversions
Bbin()Functionbin(x)Convert an integer number to a binary string that is prefixed with "0b". for bin()Numeric Conversion
Bbool()Classbool(x=False)Returns a boolean value using standard truth testing procedures. If the passed in value is false or empty; otherwise, it returns True.Numeric Conversion
Bbreakpoint()Functionbreakpoint(*args, **kws)The function is used to drop the program into a debugger at the point that it's called at.System Function
Bbytearray()Classbytearray(source=b''), bytearray(source, encoding), bytearray(source, encoding, errors)Returns a new array of bytes.Sequence Constructor
Bbytes()Classbytes(source=b''), bytes(source, encoding), bytes(source, encoding, errors)Returns a new "bytes" object which is an immutable sequence of integers in the range of 0 to 256 (inclusive). It returns an immutable version of the bytearray.String Conversions
Ccallable()Functioncallable(object)Returns True if the object arguments callable, otherwise False. Even if the function returns True, the call may still fail.Information Function
Cchr()Functionchr(i)Returns the string representing a character where the Unicode code point is the integer of the value passed in. The valid range is from 0 to 1,114,111 and the function will raise a ValueError if the value is outside of the range. for chr()String Conversions
Cclassmethod()Decorator@classmethodIs used as a decorator to transform a method into a class method. This means that the method receives the class as an implicit first argument.Object-Oriented Function
Ccompile()Functioncompile(source, filename, mode, flags=0, dont_inherit=False, optimize=-1)Is used to compile the source into a code or AST object.System Function
Ccomplex()Classcomplex(real=0, imag=0), complex(string)Returns a complex number with the value real + imag*1j or convert a string or number to a complex number.Numeric Conversion
Ddelattr()Functiondelattr(object, name)The function accepts an object and a string and is used to delete the named attribute if the object allows it.Object-Oriented Function
Ddict()Classdict(**kwargs), dict(mapping, **kwarg), dict(iterable, **kwarg)Creates a new dictionary.Mapping Constructor
Ddir()Functiondir(), dir(object)Without any arguments, the function returns the list of names in the current local scope.If an argument is passed in, returns a list of valid attributes for that object. for dir()Object-Oriented Function
Ddivmod()Functiondivmod(a, b)Takes two non-complex numbers and returns a pair of numbers that represent the quotient and the remainder when using integer division (a // b, a % b). for divmod()Arithmetic
Eenumerate()Functionenumerate(iterable, start=0)Is used to return an enumerate object, which returns an index and the object from the iterable that is passed in. for enumerate()Container Operator
Eeval()Functioneval(expression, /, globals=None, locals=None)Parses the expression passed to this method and runs python expression (code) within the program.System Function
Eexec()Functionexec(object, globs=None, locals=None, *, closure=None)Executes a dynamically created program, which is either a string or a code object.System Function
Ffilter()Functionfilter(function, iterable)Is used to construct an an iterator from the elements of the passed-in iterable for which the return returns True. for filter()Functional Programming
Ffloat()Classfloat(x=0.0)Return a floating point number constructed from a number or string x.Numeric Conversion
Fformat()Functionformat(value, format_spec='')Converts a value to a formatted representation.String Conversions
Ffrozenset()Classfrozenset(iterable=set())Returns a frozenset object.Mapping Constructor
Ggetattr()Functiongetattr(object, name), getattr(object, name, default)Returns the value of the named attribute of the object, where the name must be a string.Object-Oriented Function
Gglobals()Functionglobals()Returns the dictionary implementing the current module namespace.Information Function
Hhasattr()Functionhasttr(object, name)The arguments are an object and a string and returns True if the string is in the name of one of the attributes, otherwise False.Object-Oriented Function
Hhash()Functionhash(object)Returns the hash value of the object if it has one. This allows you to compare dictionary keys during a dictionary lookup.Identity
Hhelp()Functionhelp(), help(request)Invokes the built-in help system in the interactive use.Information Function
Hhex()Functionhex(x)Converts an integer number to a lowercase hexadecimal string prefixed with "0x".Numeric Conversion
Iid()Functionid(object)Is used to return the identity of an object. The identity is guaranteed to be unique and constant for the object during the object's lifetime.Identity
Iinput()Functioninput(), input(prompt)If a prompt is present, the prompt is written to the standard output without a trailing newline. The function is used to read a line from the input and converts it to a string.System Function
Iint()Classint(x=0), int(x, base=10)Returns an integer object that is constructed from a number or string. If no argument is provided, the function returns 0.Numeric Conversion
Iisinstance()Functionisinstance(object, classinfo)Returns Tre if the object argument is an instance of the classinfo argument (or of a subclass of the classinfo). for isinstance()Object-Oriented Function
Iissubclass()Functionissubclass(class, classinfo)Returns True if class is a subclass of class info. A class is also considered a subclass of itself. Accepts a tuple of class objects.Object-Oriented Function
Iiter()Functioniter(object), iter(object, sentinal)Returns an iterator object.Iterators
Llen()Functionlen(s)Returns the length of an object, which may be a sequence (such as a string or list) or a collection (such as a dictionary or set).Container Operator
Llist()Classlist(), list(iterable)Is a mutable sequence type, rather than a function.Sequence Constructor
Llocals()Functionlocals()Update and return a dictionary representing the current lcaol symbol table.Information Function
Mmap()Functionmap(function, iterable, *iterables)Returns an iterator that applies the function to every item of the iterable, yielding the results. for map()Functional Programming
Mmax()Functionmax(iterable, *, key=None), max(iterable, *, default, key=None), max(arg1, arg2, *args, key=None)Returns the largest item in an iterable or the largest of two or more arguments. Allows you to pass in a key that is used to determine the max by sorting an iterable.Comparisons
Mmemoryview()Classmemoryview(object)Returns a memory view object created from the given argument.Sequence Constructor
Mmin()Functionmin(iterable, *, key=None), min(iterable, *, default, key=None), min(arg1, arg2, *args, key=None)Returns the smallest item in an iterable or the largest of two or more arguments. Allows you to pass in a key that is used to determine the min by sorting an iterable.Comparisons
Nnext()Functionnext(iterator), next(iterator, default)Retrieves the next item from an iterator by calling its __next__() method. If a default value is provided, it is returned if the iterator is exhausted.Iterators
Oobject()Classobject()Is used to return a new featureless object.Object-Oriented Function
Ooct()Functionoct(x)Is used to convert an integer number to an octal string prefixed with "0a".String Conversions
Oopen()Functionopen(file, mode='r', buffering=- 1, encoding=None, errors=None, newline=None, closefd=True, opener=None)Is used to open the file passed in an return a corresponding file object.Object-Oriented Function
Oord()Functionord(c)Given a string representation of a single Unicode character, returns an integer representing the Unicode code point of that character. for ord()String Conversions
Ppow()Functionpow(base, exp, mod=None)Return base to the power exp. If mod is present, returns the base to the power exp, modulo mod. for pow()Arithmetic
Pprint()Functionprint(*objects, sep=' ', end='n', file=None, flush=False)Is used to print objects to the text stream file, separated by sep and followed by end.System Function
Pproperty()Classpropert(fget=None, fset=None, fdel=None, doc=None)Is used to return a property attribute.Object-Oriented Function
Rrange()Classrange(stop), range(start, stop, step=1)While not a function, it represents an immutable sequence type. for range()Sequence Constructor
Rrepr()Functionrepr(object)Returns a string containing a printable representation of an object.String Conversions
Rreversed()Functionreversed(seq)Return a reverse iterator. The sequence must have a __reversed__() method.Container Operator
Rround()Functionround(number, ndigits=None)Is used to return the number rounded to ndigits precision after the decimal point. If no ndigits are provided, the number is rounded to the nearest integer.Arithmetic
Sset()Classset(), set(iterable)Returns a new set object, optionally with the elements taken from an iterable.Mapping Constructor
Ssetattr()Functionsetattr(object, name, value)The arguments are an object, a string, and an arbitrary value and is used to assign the value to the attribute.Object-Oriented Function
Sslice()Classslice(stop), slice(start, stop, step=1)Returns a slice object representing the set of indeices specific by range(start, stop, step).Container Operator
Ssorted()Functionsorted(iterable, /, *, key=None, reverse=False)Returns a new sorted list from the items in the iterable. Allows you to pass in a key by which to compare values. Allows you to reverse the sequence using the reverse parameter.Container Operator
Sstaticmethod()Decorator@staticmethodIs used to transform a method into a static method, which does not receive an implicit first argument.Object-Oriented Function
Sstr()Classstr(object=''), str(object=b'', encoding='utf-8', errors='strict')rturns a string version of the passed-in object.Sequence Constructor
Ssum()Functionsum(iterable, /, start=0)Sums the items of an iterable from left to right.Container Operator
Ssuper()Classsuper(), super(type, object_or_type=None)Return a proxy object that delegates method calls to a parent or sibling class of type. This is useful for accessing inherited methods that have been overridden in a class.Object-Oriented Function
Ttuple()Classtuple(), tuple(iterable)Is an immutable sequence type, rather than a function.Sequence Constructor
Ttype()Classtype(object), type(name, bases, dict, **kwds)Returns the type of an object. The isinstance() function is preferred, as it takes subclasses into account. for type()Object-Oriented Function
Vvars()Functionvars(), vars(object)Returns the __dict__ attribute for a module, class, instance, or other object that has a __dict__ attribute.Object-Oriented Function
Zzip()Functionzip(*iterables, strict=False)Iterates over several iterables in parallel, producing tuples with an item from each one. for zip()Container Operator
___import()Function__import__(name, globals=None, locals=None, fromlist=(), level=0)The function is invoked by an import statement.System Function