#add two number by seperate function def add(a,b): return a+b a=int(input("Enter first numbern")) b=int(input("Enter second numbern"))
#add and print print("Sum is "+str(a+b))
#add by function calling ans=add(a,b) print("sum is "+str(ans)) print(add(a,b))
Output-
Enter first number 2 Enter second number 6 Sum is 8 sum is 8 8
In this program, we take two value as a input from the user and our aim to calculate the sum of the two input number so we make function add() which add two values and return the sum, so when we want to add two number we always call this function instead of written the code again.
I am Yogesh Sharma. I found this website very useful for all the students. It is a very good website for learning thousands of multiple choice questions. Basically it is like a community website. Everyone can add questions so am I. I will add mcqs in this website to help you.