def calc():
    while True:
        try:
            num1 = float(input(" first number: "))
            operation = input(" the operation : ")
            num2 = float(input(" second number: "))



            if operation == "-":
                result = num1 - num2
            elif operation == "+":
                result = num1 + num2
            elif operation == "*":
                result = num1 * num2
            
                print("Error: Invalid operation.")
                continue

            print(f"The result is: {result}")

            an_calculation = input("Do you want to perform another calculation? (yes/no): ")
            if an_calculation.lower() != 'yes':
                print("Goodbye")
                break

        except Exception as e:
            print(f"An unexpected error occurred: {e}")

        except ValueError:
            print("Error: Please enter valid numbers.")

if __name__ == "__main__":
    calc()
   