write a function to add two numbers in python
Answers
Answered by
4
#Add two numbers
x = 10
y =20
print(x+y)
#Add two numbers from user input
a = eval(input("Enter first number: "))
b = eval(input("Enter second number: "))
print("The sum of", a , "and", b, "=", a+b)
#Function to return sum of two numbers
def sum(a, b):
return a+b
print(sum(131, 1))
Answered by
2
# Python3 program to add two numbers
num1 = 15
num2 = 12
# Adding two nos
sum = num1 + num2
# printing values
print("Sum of {0} and {1} is {2}" .format(num1, num2, sum))
Similar questions