← 返回题库
中级

实现小票金额条目校验

未完成
中级参考 代码结构已给出,请填写 ____ 处
def solve():
    from pyodide.http import open_url
    from io import StringIO
    import pandas as pd
    rcp = pd.read_csv(StringIO(open_url(____).read()))
    items = pd.read_csv(StringIO(open_url(____).read()))
    checked = ____
    for rid in rcp['____'].unique():
        it = items[items['____']==rid]
        if it.empty: continue
        declared = float(____)
        total = round(it['____'].sum(), ____)
        diff = abs(____)
        print(____)
        checked += ____
        if checked >= ____: break

示例

输入
solve()
期望输出
RCP-00001: declared=245.57 items=245.58 match=False
  RCP-00002: declared=473.69 items=473.7 match=True
  RCP-00003: declared=464.81 items=464.82 match=True
  RCP-00004: declared=337.49 items=337.5 match=True
  RCP-00005: declared=36.69 items=36.68 match=True
Python 代码 🔒 登录后使用
🔒

登录后即可练习

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