fork download
  1. from collections import Counter
  2. texto = "banana"
  3. print(list(Counter(texto).items()))
Success #stdin #stdout 0.02s 9172KB
stdin
Standard input is empty
stdout
[('b', 1), ('a', 3), ('n', 2)]