- print("=== Garden Plant Health Checker ===")
-
- print("Testing good values...")
- try:
- print(check_plant_health("tomato", 5, 8))
- except ValueError as e:
- print(f"Error: {e}")
-
- print("Testing empty plant name...")
- try:
- check_plant_health("", 5, 8)
- except ValueError as e:
- print(f"Error: {e}")
-
- print("Testing bad water level...")
- try:
- check_plant_health("lettuce", 15, 8)
- except ValueError as e:
- print(f"Error: {e}")
-
- print("Testing bad sunlight hours...")
- try:
- check_plant_health("carrot", 5, 0)
- except ValueError as e:
- print(f"Error: {e}")
+ print("=== Garden Plant Health Checker ===\n")
+
+ values: list[tuple[str, str, int, int]] = [
+ ("good values", "tomato", 5, 8),
+ ("empty plant name", "", 5, 8),
+ ("bad water level", "lettuce", 15, 8),
+ ("bad sunlight hours", "carrot", 5, 0),
+ ]
+ for testing, plant, water, sun in values:
+ print(f"Testing {testing}...")
+ try:
+ print(check_plant_health(plant, water, sun))
+ except ValueError as e:
+ print(f"Error: {e}\n")