题解 | #单词统计#

单词统计

https://www.nowcoder.com/practice/0b6df47098e246ad8fc52002dcaea1fa

words_dic={
    'word':2,
    'while':15,
    'for':20,
    'if':26,
    'else':14,
    'print':9,
}

words = input().strip()
if words in words_dic.keys():
    words_dic[words]+=1
else:
    words_dic[words]=1

print(words_dic)

# 优化:可增加判断,输入的是否全是字母,若存在非字母的字符,则提示用户

全部评论

相关推荐

爱吃烤肠的牛油最喜欢...:50K是ssp了估计,ssp的人家多厉害都不用说,每年比例大概在百分之5左右
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务