自己写的和标准库对得上吗

👁️ 0 人浏览 💬 0 人评论 ❤️ 添加收藏

运行下面这段程序:

from collections import Counter
def word_count(words):
    c = {}
    for w in words:
        c[w] = c.get(w, 0) + 1
    return c

words = ["苹果", "香蕉", "苹果", "梨", "香蕉", "苹果"]
print(word_count(words) == dict(Counter(words)))
提交你的答案
请登录后提交答案。
去登录
代码编辑器
Ctrl + Enter 运行
本次输入:
输出:

                        
👩‍🏫
AI
💬 题目评论

全部评论