Skip to main content

/docs/images/banner.jpg

Python

Method Overloading

Title: WAP to show method overloading in python with sum

# WAP to show method overloading in python with sum

def add(a, b, c=0):
return a + b + c


print(add(10, 20))
print(add(10, 20, 30))

# Output:
# 30
# 60


note

Method overloading is not supported in python, but we can achieve it using default arguments