Built-In Functions

Built-In Functions#

We have actually already been working with a number of Python’s built-in functions. These include print(), dict(), input(), int(), and len().

We call built-in functions using the function name, followed by parenthesis.

  • print()

  • dict()

  • input()

  • int()

  • len()

When we call one of these built-in functions, Python accesses and then executes the funtion’s source code stored elsewhere in the Python environment.

  • For example, you can see the source code for the print() function, contained in bltinmodule.c file in Python’s source code.

Using print() as an example:

  • The function definition is contained elsewhere in Python’s source code

  • We call the function using its name print()

  • We pass some kind of input to the function (i.e. print("Hello world"))

  • Some functions have an output or return value

Comprehension Check#

Clipboard icon Built-in Functions in Python Comprehension Check