Default Function Parameters in Python: How Can You Use Them?

Claudio Sabato
6 min readMay 15, 2022

Do you know that when you define a Python function you can set a default value for its parameters? This tutorial will show you how to do it.

Generally when calling a Python function you have to provide arguments for all the parameters defined in the function. When you use default parameters you give default values to specific parameters defined in a function. If a value is passed for that parameter when calling the function that value is assigned to the parameter otherwise the parameter keeps its default value.

In this tutorial we will first see how to use default parameters and then we will understand in which scenario you would use them.

Let’s see a few examples!

How to Add a Default Parameter to a Python Function

Before starting I want to remind you the difference between parameters and arguments.

Very often the difference between these two concepts is not very clear to developers…

Parameters are the variables listed in the definition of a Python function within parentheses. Arguments are the variables you pass when calling a function (again within parentheses). The values of arguments are assigned to the parameters of a function.



Claudio Sabato

Claudio Sabato is an IT expert with over 15 years of professional experience in Python/Bash programming, Linux Systems Administration and IT Systems Design.