def add(x, y):
    return x + y

def sub(x, y):
    return x - y

def mult(x, y):
    return x * y

def divide(x, y):
    if y != 0:
        return x / y
    else:
        return "Cannot divide by zero"

while True:
    try:
        num1 = float(input("Enter the first number: "))
        operation = input("Choose the operation (+, -, *, /): ")
        num2 = float(input("Enter the second number: "))

        if operation == "+":
            print(add(num1, num2))
        elif operation == "-":
            print(sub(num1, num2))
        elif operation == "*":
            print(mult(num1, num2))
        elif operation == "/":
            print(divide(num1, num2))
        else:
            print("Please enter a valid operation.")

        next_calculation = input("Do you want to perform another calculation? (yes/no): ")
        if next_calculation.lower() != "yes":
            break
    except ValueError:
        print("Please enter a valid number.")
