# define functions for addition, subtraction, multiplication, and division def add(num1, num2): return num1 + num2 def subtract(num1, num2): return num1 - num2 def multiply(num1, num2): return num1 * num2 def divide(num1, num2): return num1 / num2 # take user input for operation choice and two numbers operation = input("Enter an operation (+, -, *, /): ") num1 = float(input("Enter the first number: ")) num2 = float(input("Enter the second number: ")) # perform the selected operation if operation == '+': result = add(num1, num2) elif operation == '-': result = subtract(num1, num2) elif operation == '*': result = multiply(num1, num2) elif operation == '/': result = divide(num1, num2) else: print("Invalid operation") # output the result print("Result: ", result)