How to Add Two Numbers in Python - Easy Programs - GeeksforGeeks

PHOTO EMBED

Thu Aug 22 2024 03:55:58 GMT+0000 (Coordinated Universal Time)

Saved by @chunder

#To define a function that take two integers 
# and return the sum of those two numbers
def add(a,b):
  return a+b

#initializing the variables
num1 = 10
num2 = 5

#function calling and store the result into sum_of_twonumbers
sum_of_twonumbers = add(num1,num2)

#To print the result
print("Sum of {0} and {1} is {2};" .format(num1,
                           num2, sum_of_twonumbers))
content_copyCOPY

https://www.geeksforgeeks.org/python-program-to-add-two-numbers/