Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
たとえば、
numbers=input("Enter numbers: ")
誰かが 11234458881 を入力した場合
どうすれば出力できますか
1が3回発生
2回1回発生
3 発生 1 回
4 2回発生
等々
カウンターを使用しない理由:
from collections import Counter Counter("11234458881")
戻り値:
Counter({'1': 3, '8': 3, '4': 2, '3': 1, '2': 1, '5': 1})