Prompt: def calculator(): # Input from the user num1 = float(input(\"Enter the first number: \")) num2 = float(input(\"Enter the second number: \")) operator = input(\"Enter the operator (+, -, *, /): \") # Perform the calculation based on the operator if operator == '+': result = num1 + num2 elif operator == '-': result = num1 - num2 elif operator == '*': result = num1 * num2 elif operator == '/': # Check for division by zero if num2 != 0: result = num1 / num2 else: print(\"Error: Division by zero is not allowed.\") return else: print(\"Error: Invalid operator.\") return # Display the result print(\"Result:\", result) # Call the calculator function to run the program calculator()