Make a simple calculator using python functions
#Define the function def Calc(n1, n2, op): ans = 0 if op == '+': ans = n1 + n2 elif op == '-': ans = n1 - n2 elif op == '*': ans = n1 * n2 elif op == '/': ans = n1 / n2 else: ans = "Invalide Operator" return ans #input the two numbers num1, num2 = int(input("Enter the first number:")), int(input("Enter the second number:")) #input the operator op = input("Enter the operator you want:") ans = Calc(num1, num2, op) print("The answer:", ans)