← 返回题库
中级

实现CO2浓度驱动的补碳决策

未完成
中级参考 代码结构已给出,请填写 ____ 处
def solve():
    from pyodide.http import open_url
    from io import StringIO
    import pandas as pd
    devs_csv = open_url(____).read()
    devs = pd.read_csv(StringIO(____))
    CO2_LOW = ____; SOLAR_MIN = ____
    def co2_decision(____):
        if ____ <= hour <= ____ and solar_rad >= SOLAR_MIN:
            if co2_ppm < CO2_LOW:
                return '____', {'____':co2_ppm,'____':solar_rad,'____':'____'}
        if co2_ppm > ____:
            return '____', {'____':co2_ppm,'____':'____'}
        return '____', {'____':co2_ppm}
    tests = [(____, ____, ____),(____, ____, ____),(____, ____, ____),(____, ____, ____),(____, ____, ____)]
    for co2, solar, hour in tests:
        decision, info = co2_decision(____)
        print("____"+str(____)+"____"+str(____)+"____"+str(____)+"____"+decision)

示例

输入
solve()
期望输出
co2=420ppm solar=650 hour=10: start_co2_generator
co2=580ppm solar=650 hour=12: start_co2_generator
co2=420ppm solar=50 hour=7: no_action
co2=2500ppm solar=0 hour=2: ventilate
co2=800ppm solar=650 hour=14: no_action
Python 代码 🔒 登录后使用
🔒

登录后即可练习

注册免费账号,在浏览器中直接运行 Python 代码