The following is a program to count only words in a string of sentence-

```
def count_letters(text):
  result = {}
  # Go through each letter in the text
  for letter in text.lower():
    # Check if the letter needs to be counted or not
    if letter.isalpha():
        if letter not in result:
          result[letter]=0
    # Add or increment the value in the dictionary
    result[letter]+=1
  return result

```

Every time I am getting this error-

```
Error on line 10:
    result[letter]+=1
KeyError: ' '

```

Can any one tell me what I am doing wrong?