Key Concepts

Review core concepts you need to learn to master this subject

Default argument is fallback value

def greet(name, msg="How do you do?"): print("Hello ", name + ', ' + msg) greet("Ankit") greet("Ankit", "How do you do?") """ this code will print the following for both the calls - `Hello Ankit, How do you do?` """

In Python, a default parameter is defined with a fallback value as a default argument. Such parameters are optional during a function call. If no argument is provided, the default value is used, and if an argument is provided, it will overwrite the default value.

Learn Python: Function Arguments
Lesson 1 of 1

What you'll create

Portfolio projects that showcase your new skills

Pro Logo

How you'll master it

Stress-test your knowledge with quizzes that help commit syntax to memory

Pro Logo