Jet*_*ett 0 python count digits
比如说
numbers=input("Enter numbers: ")
Run Code Online (Sandbox Code Playgroud)
如果有人输入11234458881
我怎样才能输出
1发生3次
2发生1次
3发生1次
4次发生2次
等等
为什么不使用Counter:
from collections import Counter
Counter("11234458881")
Run Code Online (Sandbox Code Playgroud)
收益:
Counter({'1': 3, '8': 3, '4': 2, '3': 1, '2': 1, '5': 1})
Run Code Online (Sandbox Code Playgroud)