def add(x, y):
"This function adds two numbers"
return x + y
num1 = float(input("Enter first number: "))
num2 = float(input("Enter second number: "))
print("sum of num1,num2 =", add(num1,num2))
# Todo : Create Subtraction, Multiplication and division functions,
# and print the results using the functions similar to add function
def add(x, y):
ReplyDelete"This function adds two numbers"
return x + y
def subtract(x, y):
"This function subtracts two numbers"
return x - y
num1 = float(input("Enter first number: "))
num2 = float(input("Enter second number: "))
print("sum of num1,num2 =", add(num1,num2))
print ("difference of num1, num2 =", subtract(num1, num2))
All Order of Operations Calculator
ReplyDeletedef add(x, y):
"This function adds two numbers"
return x + y
def subtract(x, y):
"This function subtracts two numbers"
return x - y
def multiply(x, y):
"This function multiplies two numbers"
return x * y
def divide(x, y):
"This function divides two numbers"
return x / y
num1 = float(input("Enter first number: "))
num2 = float(input("Enter second number: "))
print("sum of num1,num2 =", add(num1,num2))
print ("difference of num1, num2 =", subtract(num1, num2))
print ("result of multiplying num1, num2 =", multiply(num1, num2))
print ("quotient of num1, num2 =", divide(num1, num2))
- Srijan
def add(x, y):
ReplyDelete"This function adds two numbers"
return x + y
def subtract(x, y):
"This function subtracts two numbers"
return x - y
num1 = float(input("Enter first number: "))
num2 = float(input("Enter second number: "))
print("sum of num1,num2 =", add(num1,num2))
print ("difference of num1, num2 =", subtract(num1, num2))
--Surya
def add (x,y):
ReplyDelete"This function adds two numbers"
return x+y
def subtract (x,y):
"This function subtracts two numbers"
return x-y
def multiply (x,y):
"This function multiplies two numbers"
return x*y
num1 = float(input("Enter first number: "))
num2 = float(input("Enter second number: "))
print("of num1, num2 =", add(num1, num2))
print("multiplication of num1, num2=", multiply(num1, num2))
print("subtraction of num1, num2=", subtract (num1, num2))
def divide (x,y):
"This function divides two numbers"
return x/y
num1 = float(input("Enter first number"))
num2 - float(input( "Enter seond number"))
print("of num1, num2 =", divide(num1, num2))
print("division of num1, num2=", divide(num1, num2))