I have a list of strings, and I want to create a dictionary, where each word from the list will be in accordance with the number of its occurrences in the string.
That is, here is the code:
words = dict() for str in lst: words[str] += 1 When I try to run the code, on the third line I get an error with the inscription:
KeyError: 'in' What is the problem?