Как посчитать количество букв в строке без пробелов?
Это мое решение, приводящее к ошибке. Возвращает 0
PS: яЯ все еще люблю исправление моего кода :)
from collections import Counter
import string
def count_letters(word):
global count
wordsList = string.split(word)
count = Counter()
for words in wordsList:
for letters in set(words):
return count[letters]
word = "The grey old fox is an idiot"
print count_letters(word)