Below is a simple addition program demonstrated using function addition. This program shows you how to use function in Python
def addition(a,b): #This is funtion definitation
c=a+b
print("Addition = {}".format(c))
print("Enter two numbers to be added")
a=int(input())
b=int(input())
addition(a,b) #call the function addition() by passing two numbers a & b
Text in green are comments
Output:
Enter two numbers to be added
341
12
Addition = 353
No comments:
Post a Comment