Explore Courses
Liverpool Business SchoolLiverpool Business SchoolMBA by Liverpool Business School
  • 18 Months
Bestseller
Golden Gate UniversityGolden Gate UniversityMBA (Master of Business Administration)
  • 15 Months
Popular
O.P.Jindal Global UniversityO.P.Jindal Global UniversityMaster of Business Administration (MBA)
  • 12 Months
New
Birla Institute of Management Technology Birla Institute of Management Technology Post Graduate Diploma in Management (BIMTECH)
  • 24 Months
Liverpool John Moores UniversityLiverpool John Moores UniversityMS in Data Science
  • 18 Months
Popular
IIIT BangaloreIIIT BangalorePost Graduate Programme in Data Science & AI (Executive)
  • 12 Months
Bestseller
Golden Gate UniversityGolden Gate UniversityDBA in Emerging Technologies with concentration in Generative AI
  • 3 Years
upGradupGradData Science Bootcamp with AI
  • 6 Months
New
University of MarylandIIIT BangalorePost Graduate Certificate in Data Science & AI (Executive)
  • 8-8.5 Months
upGradupGradData Science Bootcamp with AI
  • 6 months
Popular
upGrad KnowledgeHutupGrad KnowledgeHutData Engineer Bootcamp
  • Self-Paced
upGradupGradCertificate Course in Business Analytics & Consulting in association with PwC India
  • 06 Months
OP Jindal Global UniversityOP Jindal Global UniversityMaster of Design in User Experience Design
  • 12 Months
Popular
WoolfWoolfMaster of Science in Computer Science
  • 18 Months
New
Jindal Global UniversityJindal Global UniversityMaster of Design in User Experience
  • 12 Months
New
Rushford, GenevaRushford Business SchoolDBA Doctorate in Technology (Computer Science)
  • 36 Months
IIIT BangaloreIIIT BangaloreCloud Computing and DevOps Program (Executive)
  • 8 Months
New
upGrad KnowledgeHutupGrad KnowledgeHutAWS Solutions Architect Certification
  • 32 Hours
upGradupGradFull Stack Software Development Bootcamp
  • 6 Months
Popular
upGradupGradUI/UX Bootcamp
  • 3 Months
upGradupGradCloud Computing Bootcamp
  • 7.5 Months
Golden Gate University Golden Gate University Doctor of Business Administration in Digital Leadership
  • 36 Months
New
Jindal Global UniversityJindal Global UniversityMaster of Design in User Experience
  • 12 Months
New
Golden Gate University Golden Gate University Doctor of Business Administration (DBA)
  • 36 Months
Bestseller
Ecole Supérieure de Gestion et Commerce International ParisEcole Supérieure de Gestion et Commerce International ParisDoctorate of Business Administration (DBA)
  • 36 Months
Rushford, GenevaRushford Business SchoolDoctorate of Business Administration (DBA)
  • 36 Months
KnowledgeHut upGradKnowledgeHut upGradSAFe® 6.0 Certified ScrumMaster (SSM) Training
  • Self-Paced
KnowledgeHut upGradKnowledgeHut upGradPMP® certification
  • Self-Paced
IIM KozhikodeIIM KozhikodeProfessional Certification in HR Management and Analytics
  • 6 Months
Bestseller
Duke CEDuke CEPost Graduate Certificate in Product Management
  • 4-8 Months
Bestseller
upGrad KnowledgeHutupGrad KnowledgeHutLeading SAFe® 6.0 Certification
  • 16 Hours
Popular
upGrad KnowledgeHutupGrad KnowledgeHutCertified ScrumMaster®(CSM) Training
  • 16 Hours
Bestseller
PwCupGrad CampusCertification Program in Financial Modelling & Analysis in association with PwC India
  • 4 Months
upGrad KnowledgeHutupGrad KnowledgeHutSAFe® 6.0 POPM Certification
  • 16 Hours
O.P.Jindal Global UniversityO.P.Jindal Global UniversityMaster of Science in Artificial Intelligence and Data Science
  • 12 Months
Bestseller
Liverpool John Moores University Liverpool John Moores University MS in Machine Learning & AI
  • 18 Months
Popular
Golden Gate UniversityGolden Gate UniversityDBA in Emerging Technologies with concentration in Generative AI
  • 3 Years
IIIT BangaloreIIIT BangaloreExecutive Post Graduate Programme in Machine Learning & AI
  • 13 Months
Bestseller
IIITBIIITBExecutive Program in Generative AI for Leaders
  • 4 Months
upGradupGradAdvanced Certificate Program in GenerativeAI
  • 4 Months
New
IIIT BangaloreIIIT BangalorePost Graduate Certificate in Machine Learning & Deep Learning (Executive)
  • 8 Months
Bestseller
Jindal Global UniversityJindal Global UniversityMaster of Design in User Experience
  • 12 Months
New
Liverpool Business SchoolLiverpool Business SchoolMBA with Marketing Concentration
  • 18 Months
Bestseller
Golden Gate UniversityGolden Gate UniversityMBA with Marketing Concentration
  • 15 Months
Popular
MICAMICAAdvanced Certificate in Digital Marketing and Communication
  • 6 Months
Bestseller
MICAMICAAdvanced Certificate in Brand Communication Management
  • 5 Months
Popular
upGradupGradDigital Marketing Accelerator Program
  • 05 Months
Jindal Global Law SchoolJindal Global Law SchoolLL.M. in Corporate & Financial Law
  • 12 Months
Bestseller
Jindal Global Law SchoolJindal Global Law SchoolLL.M. in AI and Emerging Technologies (Blended Learning Program)
  • 12 Months
Jindal Global Law SchoolJindal Global Law SchoolLL.M. in Intellectual Property & Technology Law
  • 12 Months
Jindal Global Law SchoolJindal Global Law SchoolLL.M. in Dispute Resolution
  • 12 Months
upGradupGradContract Law Certificate Program
  • Self paced
New
ESGCI, ParisESGCI, ParisDoctorate of Business Administration (DBA) from ESGCI, Paris
  • 36 Months
Golden Gate University Golden Gate University Doctor of Business Administration From Golden Gate University, San Francisco
  • 36 Months
Rushford Business SchoolRushford Business SchoolDoctor of Business Administration from Rushford Business School, Switzerland)
  • 36 Months
Edgewood CollegeEdgewood CollegeDoctorate of Business Administration from Edgewood College
  • 24 Months
Golden Gate UniversityGolden Gate UniversityDBA in Emerging Technologies with Concentration in Generative AI
  • 36 Months
Golden Gate University Golden Gate University DBA in Digital Leadership from Golden Gate University, San Francisco
  • 36 Months
Liverpool Business SchoolLiverpool Business SchoolMBA by Liverpool Business School
  • 18 Months
Bestseller
Golden Gate UniversityGolden Gate UniversityMBA (Master of Business Administration)
  • 15 Months
Popular
O.P.Jindal Global UniversityO.P.Jindal Global UniversityMaster of Business Administration (MBA)
  • 12 Months
New
Deakin Business School and Institute of Management Technology, GhaziabadDeakin Business School and IMT, GhaziabadMBA (Master of Business Administration)
  • 12 Months
Liverpool John Moores UniversityLiverpool John Moores UniversityMS in Data Science
  • 18 Months
Bestseller
O.P.Jindal Global UniversityO.P.Jindal Global UniversityMaster of Science in Artificial Intelligence and Data Science
  • 12 Months
Bestseller
IIIT BangaloreIIIT BangalorePost Graduate Programme in Data Science (Executive)
  • 12 Months
Bestseller
O.P.Jindal Global UniversityO.P.Jindal Global UniversityO.P.Jindal Global University
  • 12 Months
WoolfWoolfMaster of Science in Computer Science
  • 18 Months
New
Liverpool John Moores University Liverpool John Moores University MS in Machine Learning & AI
  • 18 Months
Popular
Golden Gate UniversityGolden Gate UniversityDBA in Emerging Technologies with concentration in Generative AI
  • 3 Years
Rushford, GenevaRushford Business SchoolDoctorate of Business Administration (AI/ML)
  • 36 Months
Ecole Supérieure de Gestion et Commerce International ParisEcole Supérieure de Gestion et Commerce International ParisDBA Specialisation in AI & ML
  • 36 Months
Golden Gate University Golden Gate University Doctor of Business Administration (DBA)
  • 36 Months
Bestseller
Ecole Supérieure de Gestion et Commerce International ParisEcole Supérieure de Gestion et Commerce International ParisDoctorate of Business Administration (DBA)
  • 36 Months
Rushford, GenevaRushford Business SchoolDoctorate of Business Administration (DBA)
  • 36 Months
Liverpool Business SchoolLiverpool Business SchoolMBA with Marketing Concentration
  • 18 Months
Bestseller
Golden Gate UniversityGolden Gate UniversityMBA with Marketing Concentration
  • 15 Months
Popular
Jindal Global Law SchoolJindal Global Law SchoolLL.M. in Corporate & Financial Law
  • 12 Months
Bestseller
Jindal Global Law SchoolJindal Global Law SchoolLL.M. in Intellectual Property & Technology Law
  • 12 Months
Jindal Global Law SchoolJindal Global Law SchoolLL.M. in Dispute Resolution
  • 12 Months
IIITBIIITBExecutive Program in Generative AI for Leaders
  • 4 Months
New
IIIT BangaloreIIIT BangaloreExecutive Post Graduate Programme in Machine Learning & AI
  • 13 Months
Bestseller
upGradupGradData Science Bootcamp with AI
  • 6 Months
New
upGradupGradAdvanced Certificate Program in GenerativeAI
  • 4 Months
New
KnowledgeHut upGradKnowledgeHut upGradSAFe® 6.0 Certified ScrumMaster (SSM) Training
  • Self-Paced
upGrad KnowledgeHutupGrad KnowledgeHutCertified ScrumMaster®(CSM) Training
  • 16 Hours
upGrad KnowledgeHutupGrad KnowledgeHutLeading SAFe® 6.0 Certification
  • 16 Hours
KnowledgeHut upGradKnowledgeHut upGradPMP® certification
  • Self-Paced
upGrad KnowledgeHutupGrad KnowledgeHutAWS Solutions Architect Certification
  • 32 Hours
upGrad KnowledgeHutupGrad KnowledgeHutAzure Administrator Certification (AZ-104)
  • 24 Hours
KnowledgeHut upGradKnowledgeHut upGradAWS Cloud Practioner Essentials Certification
  • 1 Week
KnowledgeHut upGradKnowledgeHut upGradAzure Data Engineering Training (DP-203)
  • 1 Week
MICAMICAAdvanced Certificate in Digital Marketing and Communication
  • 6 Months
Bestseller
MICAMICAAdvanced Certificate in Brand Communication Management
  • 5 Months
Popular
IIM KozhikodeIIM KozhikodeProfessional Certification in HR Management and Analytics
  • 6 Months
Bestseller
Duke CEDuke CEPost Graduate Certificate in Product Management
  • 4-8 Months
Bestseller
Loyola Institute of Business Administration (LIBA)Loyola Institute of Business Administration (LIBA)Executive PG Programme in Human Resource Management
  • 11 Months
Popular
Goa Institute of ManagementGoa Institute of ManagementExecutive PG Program in Healthcare Management
  • 11 Months
IMT GhaziabadIMT GhaziabadAdvanced General Management Program
  • 11 Months
Golden Gate UniversityGolden Gate UniversityProfessional Certificate in Global Business Management
  • 6-8 Months
upGradupGradContract Law Certificate Program
  • Self paced
New
IU, GermanyIU, GermanyMaster of Business Administration (90 ECTS)
  • 18 Months
Bestseller
IU, GermanyIU, GermanyMaster in International Management (120 ECTS)
  • 24 Months
Popular
IU, GermanyIU, GermanyB.Sc. Computer Science (180 ECTS)
  • 36 Months
Clark UniversityClark UniversityMaster of Business Administration
  • 23 Months
New
Golden Gate UniversityGolden Gate UniversityMaster of Business Administration
  • 20 Months
Clark University, USClark University, USMS in Project Management
  • 20 Months
New
Edgewood CollegeEdgewood CollegeMaster of Business Administration
  • 23 Months
The American Business SchoolThe American Business SchoolMBA with specialization
  • 23 Months
New
Aivancity ParisAivancity ParisMSc Artificial Intelligence Engineering
  • 24 Months
Aivancity ParisAivancity ParisMSc Data Engineering
  • 24 Months
The American Business SchoolThe American Business SchoolMBA with specialization
  • 23 Months
New
Aivancity ParisAivancity ParisMSc Artificial Intelligence Engineering
  • 24 Months
Aivancity ParisAivancity ParisMSc Data Engineering
  • 24 Months
upGradupGradData Science Bootcamp with AI
  • 6 Months
Popular
upGrad KnowledgeHutupGrad KnowledgeHutData Engineer Bootcamp
  • Self-Paced
upGradupGradFull Stack Software Development Bootcamp
  • 6 Months
Bestseller
upGradupGradUI/UX Bootcamp
  • 3 Months
upGradupGradCloud Computing Bootcamp
  • 7.5 Months
PwCupGrad CampusCertification Program in Financial Modelling & Analysis in association with PwC India
  • 5 Months
upGrad KnowledgeHutupGrad KnowledgeHutSAFe® 6.0 POPM Certification
  • 16 Hours
upGradupGradDigital Marketing Accelerator Program
  • 05 Months
upGradupGradAdvanced Certificate Program in GenerativeAI
  • 4 Months
New
upGradupGradData Science Bootcamp with AI
  • 6 Months
Popular
upGradupGradFull Stack Software Development Bootcamp
  • 6 Months
Bestseller
upGradupGradUI/UX Bootcamp
  • 3 Months
PwCupGrad CampusCertification Program in Financial Modelling & Analysis in association with PwC India
  • 4 Months
upGradupGradCertificate Course in Business Analytics & Consulting in association with PwC India
  • 06 Months
upGradupGradDigital Marketing Accelerator Program
  • 05 Months

Python In-Built Function [With Syntax and Examples]

By Rohit Sharma

Updated on Feb 27, 2024 | 11 min read

Share:

Built-in functions in Python are defined as those types of functions that are pre-defined in Python. The programming language Python offers several functions for performing a wide variety of tasks. Those functions which are already present in the Python interpreter are known as the built-in functions. Lots of built-in functions are available in Python. A few of the built-in functions are hash(), filter(), int(), print(), set()

built-in functions in Python

built-in functions in Python along with its examples. 

1. abs function()

Using the abs() function in Python is used for returning the absolute value of a given number. The function takes only one argument: the function’s number to return its absolute value. This argument can be of any type, such as an integer or a floating point. If, supposedly, the argument is a complex number, then the function will return the magnitude of the complex number. 

An example of the Python abs() is shown below:

Source

The output of the program will be:

Learn data science course from the World’s top Universities. Earn Executive PG Programs, Advanced Certificate Programs, or Masters Programs to fast-track your career.

2. all() function

This is another type of built-in function in Python. The function all() accepts an iterable object. Such iterable objects might be a dictionary, list, etc. Using the function all() returns the value of either true or false. If all the elements are valid in the iterable, the function returns true. Else, the function returns false. 

An example of the all() function in Python is shown below.

Source
upGrad’s Exclusive Data Science Webinar for you –

Please Fill Your Details

Select Course

3. bin() function in Python

Python’s bin() function is used for any specified integer to return that integer’s binary representation. The results of the function always have the prefix 0b. 

An example of the function bin() in Python is shown below.

Source

4. bool() in Python

This is another type of built-in function in Python. As the function’s name goes, the function converts any value to the Boolean form that means true or false. This is done through the use of the standard procedure of truth testing.

An example of the function is shown below.

The output of the program is shown below.

Source

Our learners also read: Top Python Free Courses

5. bytes() in Python

The function bytes() is used in Python for returning an object of byte. The function is immutable compared to the bytearray() function in Python. Empty bytes are created for an object of a specified size.

An example of the Python bytes() function I showed below.

6. Callable() function in Python

The callable() function, as the name specifies, can be called in the Python program. The function’s task is to check and then return the true value if the object passed through the function is callable. Else, the function returns the value of false. 

An example of the callable() function in Python is

x = 8  

print(callable(x)) 

The output of the program is False.

7. Compile() function 

The function compiles()in Python uses the input as source code and then returns an object of the code, which can be executed later through the function exec(). 

The compile() function in Python can be used as shown below.

8. Exec() function

The function exec() in Python is used for executing the Python program dynamically. It can be an object or a string, and the function accepts large segments of code compared to the function eval(), which accepts only a single expression.

9. Sum() function

 Python’s sum() function is used for getting the sum of numbers from an iterable source such as a list. 

10. Any() function in Python

If any item turns out to be true in the iterable, the function any() returns true. Else, the function returns false. 

11. Ascii() function in Python()

This is another type of built-in function in Python. It returns a string that contains object representation and then escapes the characters in the string, which are non-ASCII using \u, \U, or \x escapes.

12. Bytearray() in Python

The function bytearray() in Python returns an object of bytearray and can also carry out conversion of objects into byte arrays. It is also able to create an object of byte array of any specific size which is empty.

13. Eval() function in Python

The function eval() in Python performs the task of parsing the expression passed on to it. The function also runs the expression(code) in Python that is present within the code. 

14. Float function in Python

The built-in function float() in Python returns a floating-point number from a string or a number. 

An example of the float() function in Python is shown below.

15. globals() function in Python

The function globals() in Python returns a dictionary for the current global symbol table. The term Symbol table means a type of data structure that stores all the information necessary for the program. The symbol table includes the names of variables, classes, methods, etc.  

16. iter() function in Python

If the program has to return an object of the type iterator, then Python’s function iter() can be used. The function leads to creating an object that one element can iterate at a time. 

An example of the function iter() is shown below.

The output of the program is 

1

2

3

4

5

17. locals() function in Python

The built-in function of Python i.e., locals() is used to return a local symbol table dictionary. It is also used for the modification of the dictionary.

An example of the locals() function in Python is shown below.

18. Chr() function in Python

The function chr() is used in Python to achieve a string representing a character that further points to an integer of Unicode code. If the user uses the function chr(97), the function will return a string “a”. The function will throw an error taking an argument of the integer type that exceeds the range specified. Usually, the standard range that is specified in the argument ranges from 0-1,114,111.

An example of code using the chr() function in Python is shown below.

Source.

19. Complex() function in Python

This built-in function in Python is used for the conversion of numbers into a complex number. The function complex() is also able to convert the strings into a complex number. The first parameter is the real parts, and the second parameter is the imaginary parts.

20. delattr() function in Python

If the user wants to delete any attribute from a specified class in Python, the function delattr() can be used. The function takes two parameters. The first parameter taken is an object from the class, and the second parameter taken is the attribute that needs to be deleted. Once an attribute gets deleted, there is no more presence of the attribute in the class. After deletion of the attribute, if the attribute is tried to be called through the object of the class, then the program throws an error. 

An example of code showing the use of the function delattr() in Python is shown below.

21. dir() function in Python

For returning a list of the names in the local scope, the function dir() is used in Python. 

22. divmod() function in Python

In Python, the function divmod() is used for getting the quotient and the remainder of two numbers. The function takes two arguments in the numeric form, and a tuple is returned. For proper functioning, the function should have both arguments and it should be numeric. 

23. dict() function in Python

The function dict() in Python acts as a constructor that leads to creating a dictionary. The Python dictionary provides three different types of constructors for creating a dictionary. 

  • An empty dictionary is created when no arguments are passed.
  • The same pair of key-value dictionaries are created when positional arguments are used.
  • In case of the keyword arguments, the arguments of the keyword and the values are further added to the created dictionary from positional arguments.

Conclusions

Apart from the above-mentioned built-in functions, Python has many other built-in functions specially designed to perform special functions. If you want to know more about the Python built-in functions and want to have practical knowledge of the programming language, check the Online Data Science Program offered by upGrad. The certificate course is provided in association with the IIIT Bangalore. Further details of the course can be explored on our website. Also, if any assistance is required, our team may be contacted for help.

Check out The Trending Python Tutorial Concepts in 2024

Frequently Asked Questions (FAQs)

1. What does the built-in function in Python mean?

2. What do the built-in abs() function do?

3. In Python, how many built-in functions are present?

Rohit Sharma

596 articles published

Get Free Consultation

+91

By submitting, I accept the T&C and
Privacy Policy

Start Your Career in Data Science Today

SuggestedBlogs