def calculator():
    while True:
        try:
            num1 = float(input("Enter the first number: "))
            operator = input("Enter an operator (+, -, *, /): ")
            num2 = float(input("Enter the second number: "))

            if operator == "+":
                result = num1 + num2
            elif operator == "-":
                result = num1 - num2
            elif operator == "*":
                result = num1 * num2
            elif operator == "/":
                if num2 == 0:
                    print("Error: Division by zero is not allowed.")
                    continue
                result = num1 / num2
            else:
                print("Error: Invalid operator.")
                continue

            print("Result:", result)
        except ValueError:
            print("Error: Invalid input.")
        finally:
            choice = input("Do you want to perform another calculation? (yes/no): ")
            if choice.lower() != "yes":
                break

    print("Thank you for using the calculator!")

calculator()