Python Built-in Functions

Let’s look at built-in functions

  1. Notice

    Built-in functions are available without importing a module. Pick the operation that matches your value and the result you need.

  2. Try

    Follow the example, change its sample, and compare what happens.

  3. Check

    Explain the result and test your understanding.

Watch how it works

Focus on how the names, objects, and calculations change. We’ll inspect the printed output in the next section.

Explore the idea

Follow the code and watch its state change. Guided simulation.

Code
Python
values = [3, 2, 5]
print(len(values))
print(sum(values))
print(max(values))
Live state

Top-level scope

values→Object 1
Object 1 · list[3, 2, 5]
This step

Built-in functions are available without importing a module. Pick the operation that matches your value and the result you need.

Picture built-in functions

Built-in functions are available without importing a module. Pick the operation that matches your value and the result you need.

Image brief

Alt text
A diagram for Python Built-in Functions. Instructions: values = [3, 2, 5] print(len(values)) print(sum(values)) print(max(values)). Displayed result: 3 10 5. The final example bindings are values --> object 1 (list). object 1: [3, 2, 5]
Image generation prompt
Create a clean educational illustration for a Python programming lesson titled "Python Built-in Functions". Teaching focus: Built-in functions are available without importing a module. Pick the operation that matches your value and the result you need. Depict exactly the relationships and labels in this reference diagram: EXAMPLE INSTRUCTIONS values = [3, 2, 5] print(len(values)) print(sum(values)) print(max(values)) | v DISPLAYED RESULT 3 10 5 FINAL BINDINGS values --> object 1 (list) object 1: [3, 2, 5] Use a flat vector style, generous spacing, clear arrows and legible labels, with a restrained blue/teal palette on a plain background. The diagram must explain the programming idea accurately. Do not depict variables as boxes containing copied objects when they share a reference. Avoid mascots, decorative screenshots, logos, gradients and extra text. Landscape composition, approximately 3:2, suitable for a course card. Accessible description: A diagram for Python Built-in Functions. Instructions: values = [3, 2, 5] print(len(values)) print(sum(values)) print(max(values)). Displayed result: 3 10 5. The final example bindings are values --> object 1 (list). object 1: [3, 2, 5]

Follow the execution

Choose a different sample input, then follow every step through to the output. Before revealing it, predict what the program will display.

Execution workspace

Choose a sample and follow its execution. Guided simulation.

Code
Python
values = [3, 2, 5]
print(len(values))
print(sum(values))
print(max(values))
Live state

Top-level scope

values→Object 1
Object 1 · list[3, 2, 5]
This step

The example has finished. Compare the final output with the values and references above.

Terminal
Output
3
10
5

What do you expect this program to print?

What does this example display?

values = [3, 2, 5]
print(len(values))
print(sum(values))
print(max(values))
What does this example display?
Choose one answer. You can try again.

Answer and explanation

3 10 5

Follow the printed values in order. The output is: 3 10 5

Which explanation matches what you learned?

Which explanation matches what you learned?
Choose one answer. You can try again.

Answer and explanation

Built-in functions are available without importing a module. Pick the operation that matches your value and the result you need.

Built-in functions are available without importing a module. Pick the operation that matches your value and the result you need.

More examples and reference

Python comes with a set of built-in functions that help you perform basic to advanced operations without importing any external libraries. Below is a complete list of these functions arranged in alphabetical order.

Python Built-in Functions Table

Function Name Description
abs()Returns the absolute value of a number.
aiter()Returns an asynchronous iterator for an asynchronous iterable.
all()Returns True if all elements of the iterable are true.
anext()Retrieves the next item from an async iterator.
any()Returns True if any element of the iterable is true.
ascii()Returns a readable ASCII representation of an object.
bin()Converts an integer to a binary string.
bool()Converts a value to a Boolean (True or False).
breakpoint()Drops you into the debugger at the call site.
bytearray()Returns a new array of bytes.
bytes()Returns a new bytes object.
callable()Checks if the object appears callable (like functions).
chr()Returns the string representing a character from a Unicode code.
classmethod()Transforms a method into a class method.
compile()Compiles source into a code object.
complex()Creates a complex number.
delattr()Deletes an attribute from an object.
dict()Creates a new dictionary.
dir()Returns the list of names in the current local scope.
divmod()Returns the quotient and the remainder of a division.
enumerate()Returns an enumerate object.
eval()Evaluates a Python expression as a string.
exec()Executes the dynamically created program.
filter()Constructs an iterator from elements for which a function returns true.
float()Converts a string or a number to a floating point number.
format()Formats a value using a format specifier.
frozenset()Returns an immutable frozenset object.
getattr()Returns the value of a named attribute of an object.
globals()Returns a dictionary representing the current global symbol table.
hasattr()Checks if an object has a given attribute.
hash()Returns the hash value of the object.
help()Invokes the built-in help system.
hex()Converts an integer to a hexadecimal string.
id()Returns the identity of an object.
input()Reads a line from input.
int()Converts a string or number to an integer.
isinstance()Checks if an object is an instance of a class.
issubclass()Checks if a class is a subclass of another class.
iter()Returns an iterator object.
len()Returns the number of items in an object.
list()Creates a list object.
locals()Updates and returns a dictionary of the current local symbol table.
map()Applies a function to all items in an input list.
max()Returns the largest item in an iterable or arguments.
memoryview()Returns a memory view object.
min()Returns the smallest item in an iterable or arguments.
next()Retrieves the next item from an iterator.
object()Returns a new featureless object.
oct()Converts an integer to an octal string.
open()Opens a file and returns a corresponding file object.
ord()Returns an integer representing the Unicode code of a character.
pow()Returns base to the exponent power, optionally modulo.
print()Prints to the standard output device.
property()Returns a property attribute.
range()Generates a sequence of numbers.
repr()Returns a string representation of an object.
reversed()Returns a reversed iterator.
round()Rounds a number to a specified number of digits.
set()Creates a new set object.
setattr()Sets the value of an attribute of an object.
slice()Creates a slice object.
sorted()Returns a sorted list from the specified iterable.
staticmethod()Transforms a method into a static method.
str()Returns a string version of an object.
sum()Sums the items of an iterable.
super()Returns a proxy object that delegates method calls to a parent class.
tuple()Creates a new tuple object.
type()Returns the type of an object.
vars()Returns the __dict__ attribute of an object.
zip()Combines several iterables into tuples.
__import__()Used by the import statement to import a module.

How to Use This Table

Click on any function name to dive deeper into its usage, syntax, examples, and best practices.

What to remember

Connect what you noticed in the example with the idea below.

Remember

Built-in functions are available without importing a module. Pick the operation that matches your value and the result you need.

Watch out for this idea

Every built-in function accepts every possible object.

This is the misconception to avoid.

Reaching the recap and completing the quizzes are separate milestones.

    Next lesson: Python String Methods →