In this python function program, we will create a function to get the addition with the return statement.
What is Function?
It is a block of code that executes when it is called.
To create a function use def keyword.
Steps to solve the program
- Create a function add.
- Use the def keyword to define the function.
- Pass two parameter i.e. numbers.
- Get the addition of the numbers using ” + ” operator.
- Return the total.
- Pass the numbers to the function while calling the function.
def add(a,b):
total = a+b
return total
add(5,15)
Output :
20
Related Articles
Python function program to create a Fruitshop Management system.
Python function program to check whether the given year is a leap year.
Python function program to reverse an integer.
Python function program to create a library management system.
Python function program to add two Binary numbers.
Python function program to search words in a string.