Built-in Functions of Python

Built-in Functions of Python

Python has a number of built-in functions which can be used in any script without any problem. They are always available for use. For example: print() function is one of the built-in functions that is used to print an object on the screen or any other standard output devices. A list in the form a table is provided below which briefly describes what each built-in function does.

 

Built-in Functions of Python Description
abs() This method returns an absolute value of a given number.
all() This method returns True if boolean value of all elements in an iterable is True otherwise False.
any() This method returns True if boolean value of any element in an iterable is True otherwise False.
ascii() This method returns readable form of an object and an escape character for any non-ascii character.
bin() This method returns binary equivalent of a number.
bool() This method returns the boolean value of an object.
bytearray() This method returns an array of bytes.
bytes() This method returns a bytes object.
callable() This method returns True if the specified object is callable otherwise False.
chr() This method returns a character whose unicode code is specified.
classmethod() This method converts a method into a class method.
compile() This method converts specified source into a ready to be executed object and returns it.
complex() This method returns a complex number.
delattr() This method deletes the specified attribute which can be a method or a property from the specified object.
dict() This method creates a dictionary out of an iterable object with key-value pairs.
dir() This method returns the properties and the methods of the specified object.
divmod() This method returns both the quotient and the remainder when the first argument is divided by the second argument.
enumerate() This method takes a collection like a tuple as an argument and return it as an enumerate object.
eval() This method evaluates and executes an expression.
exec() This method executes the specifies code or the object.
filter() This method uses a function to filter out or exclude some items from an iterable object.
float() This method returns a floating point number.
format() This method formats a specified value.
frozenset() This method returns a frozenset object.
getattr() This method returns value of the specifies attribute of the object which can be a property of a method.
globals() This method returns the current global table as a dictionary containing key-value pairs.
hasattr() This method returns True if the specified object has the specified attribute which can be a property or a method and if not, returns False.
hash() This method returns hash value of the specified object.
help() This method executes the built-in help system and displays information regarding the specified object, method, etc.
hex() This method converts a number into it’s hexadecimal equivalent.
id() This method returns the id of an object.
input() This method is used to take input from the user.
int() This method returns an integer number.
isinstance() This method returns True if the specified object is an instance of the specified class, if not, returns False.
issubclass() This method returns True if the specified class is a subclass of the other specified class, if not, returns False.
iter() This method returns an iterator object.
len() This method returns the length of specified object.
list() This method returns a list.
locals() This method returns the current local table as a dictionary containing key-value pairs.
map() This method returns the specified iterator after applying a function to every element of the iterator.
max() This functions returns the largest item in an iterable.
memoryview() This function returns a memory view object.
min() This function returns the smallest item in an iterable.
next() This function returns the next item in an iterable.
object() This function returns a new object.
oct() This function converts a number into an octal.
open() This function opens a file and returns a file object.
ord() This function converts an integer representing the Unicode of the specified character.
pow() This function returns the value of x to the power of y.
print() This function prints to the standard output device.
property() This function gets, sets, deletes a property.
range() This function returns a sequence of numbers, starting from 0 and increments by 1 (by default).
repr() This function returns a readable version of an object.
reversed() This function returns a reversed iterator.
round() This function rounds a number.
set() This function returns a new set object.
setattr() This function sets an attribute (property/method) of an object.
slice() This function returns a slice object.
sorted() This function returns a sorted list.
@staticmethod() This function converts a method into a static method.
str() This function returns a string object.
sum() This function sums the items of an iterator.
super() This function returns an object that represents the parent class.
tuple() This function returns a tuple.
type() This function returns the type of the specified object.
vars() This function returns the __dict__ property of an object.
zip() This function returns an iterator, from two or more iterators.

 

Share this post

2 thoughts on “Built-in Functions of Python

Leave a Reply

Your email address will not be published. Required fields are marked *