← 返回题库
中级

检查服务版本兼容性

未完成
中级参考 代码结构已给出,请填写 ____ 处
def solve():
    from pyodide.http import open_url
    from io import StringIO
    import pandas as pd
    reg_csv = open_url(____).read()
    reg = pd.read_csv(StringIO(____))
    def check_version_compat(____):
        instances = reg[(____)&(____)]
        compatible = instances[instances['____']==client_version]
        any_ver = instances
        return {'____':service,'____':client_version,
            '____':len(____),'____':len(____),
            '____':len(____)>____}
    for svc in reg['____'].unique():
        for ver in ['____','____']:
            r = check_version_compat(____)
            print(____)

示例

输入
solve()
期望输出
data-ingestion client=v1: compatible=2, fallback=True
data-ingestion client=v2: compatible=1, fallback=True
alert-engine client=v1: compatible=1, fallback=True
alert-engine client=v2: compatible=0, fallback=True
cmd-dispatcher client=v1: compatible=1, fallback=True
cmd-dispatcher client=v2: compatible=0, fallback=True
Python 代码 🔒 登录后使用
🔒

登录后即可练习

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