← 返回题库
中级

实现SOV声量占比计算

未完成
中级参考 代码结构已给出,请填写 ____ 处
def solve():
    import random; random.seed(____)
    campaigns = [{'____':'____','____':random.randint(____,____)},{'____':'____','____':random.randint(____,____)},{'____':'____','____':random.randint(____,____)},{'____':'____','____':random.randint(____,____)}]
    total = sum(____)
    def sov(____): return round(____) if total>____ else ____
    print("____"+str(____)+"____")
    for c in campaigns:
        s = sov(____)
        print("____"+c['____']+"____"+str(____)+"____"+str(____)+"____")
    print("____"+str(round(sum(sov(____) for c in campaigns),____))+"____")

示例

输入
solve()
期望输出
SOV calculation (total=904):
  CMP-0001: imps=306 SOV=33.85%
  CMP-0002: imps=294 SOV=32.52%
  CMP-0003: imps=101 SOV=11.17%
  CMP-0004: imps=203 SOV=22.46%
SOV sum: 100.0% (~100%)
Python 代码 🔒 登录后使用
🔒

登录后即可练习

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