Ratings & reviews

4.112 ratings

Marcello S.

11 days ago

Need to understand practical examples where functions changes our daily lives, not only coding snippets.

Tien N.

12 days ago

This lesson was a little bit harder to understand. I wish there was a little more explanation in the solutions.

Kjell W.

13 days ago

Good explaining… Step by step learning to code


Complete all chapters to get certificate


What is Function in Python?


Now we will consider what a function in Python and some basic techniques used to create functions is: what are the arguments of the function, what is the return value of the function, what is the body of the function, and how to use the function in the code.

What Is Function?


Return Value

Function Body

Built-in Functions

Function Argument Specification


Python is a fairly flexible language in terms of creating functions. This is especially true in setting function arguments - there are several different types of function arguments, and you can choose any of them depending on the problem you are solving. Let's now take a closer look at them.

Positional Arguments. Optional Arguments

Challenge: Optional Arguments

Arbitrary Arguments

Combination of Positional, Arbitrary and Optional Arguments

Arbitrary Keyword Arguments

Using Combinations of All Argument Types

Function Return Value Specification


The return value of a function is the direct result of the execution of the function, which we can use in the program. There are several types of function return values - now we will consider the most commonly used.

Single Return Value

Multiple Return Values

None Return Value

Generator Functions

Some Additional Topics


Now it's time to consider additional topics to help make your functions more flexible and solve more complicated tasks. You will understand recursion, lambda functions, and some basics principles of writing effective and maintainable functions.


Lambda Functions

Writing Effective and Maintainable Functions