class Plant:
    def __init__(self, name, water):
        self.name = name
        self.water = water


tomato = Plant("tomato", 10)
lettuce = Plant("lettuce", 5)
carrots = Plant("carrots", 7)


def water_plants(plants_list):
    print("Open watering system")
    try:
        for p in plants_list:
            p.water += 1
            print(f"Watering {p.name}")
    except AttributeError:
        print(f"Error: Cannot water {p} - invalid plant!")
    else:
        print("Watering completed successfully!")
    finally:
        print("Closing watering system (cleanup)")


def test_watering_system():
    print("=== Garden Watering System ===")
    plantlist = [tomato, lettuce, carrots]
    badlist = [tomato, None, lettuce]
    print("\nTesting normal watering...")
    water_plants(plantlist)
    print("\nTesting with error...")
    water_plants(badlist)
    print("\nCleanup always happens, even with errors!")


test_watering_system()
