class Sensor:
    def __init__(self, humidity):
        self.humidity = humidity


class WaterPump:
    def supply_water(self, amount):
        print(f"워터펌프를 가동하여 {amount}ml의 물을 공급합니다.")


class SmartFarm:
    def __init__(self):
        self.threshold = 30

    def check(self, sensor, pump):
        if sensor.humidity < self.threshold:
            print(f"습도 부족({sensor.humidity}%). ", end="")
            pump.supply_water(500)
        else:
            print("습도 정상입니다.")


sensor = Sensor(25)
pump = WaterPump()
farm = SmartFarm()

farm.check(sensor, pump)

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: