Robotics & Artificial Intelligence
Write a Python program to demonstrate the concept of default arguments in a function.
Python Functions
3 Likes
Answer
def add_numbers(a, b=5):
print(a + b)
add_numbers(3)
add_numbers(9, 4)Output
8
13
Answered By
1 Like
Related Questions
Write a Python program to calculate the area of a square and a rectangle by defining a function.
Write a Python program to print the table of a given number by using a function.
Is the return statement mandatory for every function?
Write a function that returns the greater of two numbers passed as arguments.