Built in Functions in Python: Explained with Examples
Updated on Dec 30, 2024 | 5 min read | 5.4k views
Share:
For working professionals
For fresh graduates
More
Updated on Dec 30, 2024 | 5 min read | 5.4k views
Share:
In Python, a function is a block of statements related to each other and performs a particular operation or task. There are three types of functions in Python. They are Built-in or library functions, User-defined functions and Anonymous functions. The functions defined by the programmer or the user to perform a specific task is called the user-defined function in Python. Anonymous functions are those functions in a Python code without mentioning a name.
Check out our free courses to get an edge over the competition.
Built in functions in Python are those functions that are predefined in Python to perform default tasks. These are the functions available within the Python interpreter for use at any instant it is invoked. There are 69 built in functions in Python.
Learn Software Development Courses online from the World’s top Universities. Earn Executive PG Programs, Advanced Certificate Programs or Masters Programs to fast-track your career.
Built-in function | Task Performed |
abs() | Absolute value of a number is returned. |
all() | A true value is returned when all elements in the iterable are true. |
any() | This function is responsible for checking if any of the iterable elements is true. |
ascii() | A string with printable illustration is returned. |
bin() | It converts an integer to a binary number. |
bool() | This function is invoked to convert a value to Boolean. |
breakpoint() | It is called to drop the user into the debugger. |
bytearray() | An array given byte size is returned when this function is called. |
bytes() | This function returns an array of bytes with an integer sequence that cannot be changed. |
callable() | The function is invoked to check if an Object can be called or not. |
chr() | A string is returned from an integer. |
classmethod() | The class method of a given function is returned. |
compile() | Returns the Object of a Python code. |
complex() | This function is invoked to generate a complex number. |
delattr() | The attributes of the Object are deleted when this function is called. |
dict() | A dictionary can be with this function. |
dir() | With this function, an attempt is made to return the Object’s attributes. |
divmod() | Used to return a tuple of quotients and remainder in integer division. |
enumerate() | An Enumerate Object is returned. |
eval() | This function executes a Python code within the written program. |
exec() | We use this function to facilitate the dynamic execution of Python code. |
filter() | An iterator is developed for those elements for which the function returns a true value. |
float() | With this function, a number or a string can return a floating-point value. |
format() | The returned value is converted to a formatted representation. |
frozenset() | The function returns a new frozenset Object that cannot be altered. |
getattr() | The function is invoked to return the value of an Object’s named attribute. |
globals() | The current global symbol table’s dictionary is returned. |
hasattr() | It tells whether the Object or string has a named attribute or not. |
hash() | This function is invoked to obtain the hash value of an Object. |
help() | An in-built help system is invoked for interaction. |
hex() | To accomplish the integer to hexadecimal conversion. |
id() | Identity of an Object is returned. |
input() | A string line is read and returned. |
int() | An integer value is returned from a number or a string. |
isinstance() | To examine whether an Object is the class’s instance. |
issubclass() | To check whether the invoked class is a subclass of another class or not. |
iter() | An iterator is returned when this function is called. |
len() | To return the length of an Object. |
list() | This function generates a list in Python code. |
locals() | The current local symbol table’s dictionary is returned. |
map() | An iterator that applies the function to return the list with the invoke of this function. |
max() | The item with maximum value in the iterable is returned. |
memoryview() | The given argument’s ‘memory view’ Object is returned. |
min() | The function returns an item with the minimum value in the iterable. |
next() | The function is used to retrieve the iterator’s next item. |
object() | The function returns a new featureless Object. |
oct() | An octal representation of the given integer is returned. |
open() | The function opens a file and returns the file Object. |
ord() | The Unicode character’s integer value is returned. |
pow() | The exponent of a number is returned. |
print() | Used to print the given Object. |
property() | The function is used to return property attribute |
range() | Invoked to return a sequence of integers from start to stop. |
repr() | Returns a string with the Object’s printable representation. |
reversed() | This function is used to obtain the reverse of an iterator sequence. |
round() | A number is rounded to specified decimal. |
set() | The function formulates and returns a set. |
setattr() | It sets a value to the Object’s attribute. |
slice() | A slice Object is returned with this function. |
sorted() | The sorted list of given iterable is extracted with this function. |
staticmethod() | A method is transformed into a static method. |
str() | An Object’s string version is returned. |
sum() | Elements of the iterable are added. |
super() | The base class’s proxy Object is returned. |
tuple() | The function returns a tuple. |
type() | The type of an Object is returned. |
vars() | The function returns the _dict_ attribute of an Object. |
zip() | An aggregate is made from elements of each iterable. |
_import__() | The ‘import’ statement invokes this function. |
At upGrad, our Executive Post Graduate Programme in Software Development – Specialisation Cloud Backend Development, offered in collaboration with IIITB, is a 12-15 months program aimed at both freshers and experienced professionals wanting to understand cloud computing in more detail. The course is highly training-oriented and gives you all the practical exposure you require to get started in the world of software development and cloud computing. Check out the course page and get yourself enrolled soon!
Get Free Consultation
By submitting, I accept the T&C and
Privacy Policy
India’s #1 Tech University
Executive PG Certification in AI-Powered Full Stack Development
77%
seats filled
Top Resources