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

Course Content

Python Functions Tutorial

Python Functions Tutorial

1. What is a Function in Python?
2. Positional and Optional Arguments
3. Arbitrary Arguments
4. Function Return Value Specification
5. Recursion and Lambda Functions

book
Built-in Functions

Built-in functions in Python are predefined functions that are readily available for use in any Python program without requiring additional specifications or definitions. One of these built-in functions is the print() function, which we have already used. We didn't need to define this function, write its body, or specify the return value; we simply called it and provided inputs. There are many built-in functions in Python. Let's consider some of the most commonly used ones:

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.

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

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
We're sorry to hear that something went wrong. What happened?
some-alt