How to Use a Default Parameter Value in Python


In this example we will show how to use a default parameter value in Python.

Source Code

def my_function(name = 'Jim'):
    print('My name is ' + name)

my_function('Steven')
my_function()
my_function('Tom')

Output:

My name is Steven
My name is Jim
My name is Tom
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments