title: Word Frequency Counter Python
body: <p>Struggling with this exercise which must use a dictionary and count the number of times each word appears in a number of user inputs. It works in a fashion, but does not atomise each word from each line of user input. So instead of counting an input of 'happy days' as 1 x happy and 1 x days, it gives me 1 x happy days. I have tried split() along with the lower() but this converts the input to a list and I am struggling with then pouring that list into a dictionary. </p>
  
  <p>As you may have guessed, I'm a bit of a novice, so all help would be greatly appreciated!</p>
  
  <pre><code>occurrences = {}
  while True:
      word = input('Enter line: ')
      word = word.lower() #this is also where I have tried a split()
      if word =='':
          break
  occurrences[word]=occurrences.get(word,0)+1
  for word in (occurrences):
      print(word, occurrences[word])
  </code></pre>
  
  <p><strong>EDIT</strong></p>
  
  <p>Cheers for responses. This ended up being the final solution. They weren't worried about case and wanted the final results sorted().</p>
  
  <pre><code>occurrences = {}
  while True:
      words = input('Enter line: ')
      if words =='':
          break
      for word in words.split(): 
          occurrences[word]=occurrences.get(word,0)+1
  for word in sorted(occurrences):
      print(word, occurrences[word])
  </code></pre>