This commit is contained in:
David Gailleton
2025-12-24 14:05:01 +00:00
parent c8229eb2be
commit 4a538a844d

View File

@@ -0,0 +1,20 @@
def water_plants(plant_list: []) -> None:
for plant in plant_list:
if plant == None:
raise ValueError
print("Watering", plant)
def test_watering_system() -> None:
plants = ["tomato", "lettuce", "carrots", None]
try:
print("Opening watering system")
water_plants(plants)
except:
print("Error: Cannot water None - invalid plant!")
finally:
print("Closing watering system (cleanup)")
if __name__ == "__main__":
test_watering_system()