def add(x, y):
    return x + y

def subtract(x, y):
    return x - y

def multiply(x, y):
    return x * y

def divide(x, y):
    if y == 0:
        raise ValueError("Cannot divide by zero")
    return x / y

def calculate(operation, x, y):
    if operation == '+':
        return add(x, y)
    elif operation == '-':
        return subtract(x, y)
    elif operation == '*':
        return multiply(x, y)
    elif operation == '/':
        return divide(x, y)
    else:
        raise ValueError("Invalid operation")

def main():
    while True:
        print("\nWelcome to the Simple Calculator!")
        print("Enter 'q' to quit the program.")
        operation = input("Enter the operation (+, -, *, /): ")
        if operation == 'q':
            break
        try:
            x = float(input("Enter the first number: "))
            y = float(input("Enter the second number: "))
            result = calculate(operation, x, y)
            print(f"Result: {result}")
        except ValueError as e:
            print(str(e))

if __name__ == "__main__":
    main()