White a function the will accept three arguments, two numbers and an operation sign among "+", "-", "/", and "x". The function should apply the operation on the two numbers and return the result to the caller. This is a basic calculator.

Respuesta :

TJC07

Answer:

Here you go :)

Explanation:

Change this however you'd like:

def calc(n1, op, n2):

   if op.lower() == "x":

       return n1*n2

   elif op == "+":

       return n1+n2

   elif op == "-":

       return n1-n2

   elif op == "/":

       return n1/n2

   else:

       return "error"

num1 = float(input("Input first number: "))

oper = input("Input operator: ")

num2 = float(input("Input second number: "))

print(calc(num1, oper, num2))