def garden_operations():
    print("=== Garden Error Types Demo ===\n")
    print("Testing ValueError...")
    try:
        int("abc")
    except ValueError:
        print("Caught ValueError: invalid literal for int()")
    print("\nTesting ZeroDivisionError...")
    try:
        5 / 0
    except ZeroDivisionError:
        print("Caught ZeroDivisionError: division by zero")
    print("\nTesting FileNotFoundError...")
    try:
        name = "missing.txt"
        open("/home/masalvad/work/poo/garden_guardian/ex1/" + name, "r")
    except FileNotFoundError:
        print(f"Caught FileNotFoundError: No such file '{name}'")
    print("\nTesting KeyError...")
    try:
        fruit = {"name": "apple", "color": "red"}
        key = "price"
        print(fruit[key])
    except KeyError:
        print(f"Caught KeyError: '{key}’")
    print("\nTesting multiple errors together...")
    try:
        fruit = {"name": "apple", "color": "red"}
        key = "price"
        print(fruit[key])
        name = "missing.txt"
        open("/home/masalvad/work/poo/garden_guardian/ex1/" + name, "r")
        5 / 0
        int("abc")
    except (ValueError, FileExistsError, FileNotFoundError, KeyError):
        print("Caught an error, but program continues!")
    print("\nAll error types tested successfully!")


garden_operations()
