← 返回题库
中级

实现AA分账金额计算

未完成
中级参考 代码结构已给出,请填写 ____ 处
def solve():
    from pyodide.http import open_url
    from io import StringIO
    import pandas as pd
    sh=pd.read_csv(StringIO(open_url(____).read()))
    print(____)
    for _,r in sh.head(____).iterrows():
        n=len(str(____).split(____))+____
        print(____)
    print(____)

示例

输入
solve()
期望输出
AA split records:
  SHR-00001: 礼物拼单 total=417.67 4ppl per=104.42 [pending]
  SHR-00002: 旅行分摊 total=416.56 2ppl per=208.28 [pending]
  SHR-00003: 聚餐AA total=144.43 3ppl per=48.14 [partial_paid]
  SHR-00004: 房租分摊 total=58.46 2ppl per=29.23 [partial_paid]
  SHR-00005: 聚餐AA total=406.87 2ppl per=203.44 [partial_paid]
By status: {'completed': np.int64(15), 'partial_paid': np.int64(12), 'pending': np.int64(13)}
Python 代码 🔒 登录后使用
🔒

登录后即可练习

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