题解 | #使用字典计数#

使用字典计数

https://www.nowcoder.com/practice/74f7e7f2344f4754bc56d862838cbfc3

设置对应所需变量

word = list(input())
dictionary = dict()

利用for循环遍历列表word并进行技术,添加至字典中

for i in word:
    value = word.count(i)
    dictionary[i] = value
print(dictionary)
全部评论

相关推荐

点赞 评论 收藏
分享
评论
19
收藏
分享

创作者周榜

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