Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Learn Built-In Functions | What Is a Function in Python?
Python Functions Tutorial

bookBuilt-In Functions

Built-in functions in Python are predefined and available for use without any additional setup. One example is the print() function, which you have already used. You do not need to define it, write its body, or specify its return value β€” you simply call it and provide inputs.

Here are some of the most commonly used built-in functions:

  • print(): Outputs a specified message or variable to the console.
1
print("My message")
copy

len(): Returns the number of elements in an object, such as a string, list, or tuple.

12
word = "Codefinity" print("Word length:", len(word))
copy

sum(): Computes the total of a sequence of numbers.

12
numbers = [5, 2, 3] print("Sum of numbers:", sum(numbers))
copy

max() and min(): Return the maximum or minimum value from a sequence.

123
numbers = [5, 2, 3] print("The largest among the numbers:", max(numbers)) print("The smallest of the numbers:", min(numbers))
copy

You might already be familiar with these functions, or perhaps not. The key in this chapter is to understand the difference between built-in functions and those you create yourself.

question mark

Which of the following best describes the difference between built-in functions and your own functions?

Select the correct answer

Everything was clear?

How can we improve it?

Thanks for your feedback!

SectionΒ 1. ChapterΒ 6

Ask AI

expand

Ask AI

ChatGPT

Ask anything or try one of the suggested questions to begin our chat

Awesome!

Completion rate improved to 4.17

bookBuilt-In Functions

Swipe to show menu

Built-in functions in Python are predefined and available for use without any additional setup. One example is the print() function, which you have already used. You do not need to define it, write its body, or specify its return value β€” you simply call it and provide inputs.

Here are some of the most commonly used built-in functions:

  • print(): Outputs a specified message or variable to the console.
1
print("My message")
copy

len(): Returns the number of elements in an object, such as a string, list, or tuple.

12
word = "Codefinity" print("Word length:", len(word))
copy

sum(): Computes the total of a sequence of numbers.

12
numbers = [5, 2, 3] print("Sum of numbers:", sum(numbers))
copy

max() and min(): Return the maximum or minimum value from a sequence.

123
numbers = [5, 2, 3] print("The largest among the numbers:", max(numbers)) print("The smallest of the numbers:", min(numbers))
copy

You might already be familiar with these functions, or perhaps not. The key in this chapter is to understand the difference between built-in functions and those you create yourself.

question mark

Which of the following best describes the difference between built-in functions and your own functions?

Select the correct answer

Everything was clear?

How can we improve it?

Thanks for your feedback!

SectionΒ 1. ChapterΒ 6
some-alt