from collections import Countertexto = "banana"print(list(Counter(texto).items()))
Standard input is empty
[('b', 1), ('a', 3), ('n', 2)]
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!