title: Python Bigram dictionary format
body: <p>For school I have to make a dictionary which contains information about consecutive words in a text file.</p>
  
  <p>For every word in the file I have to make an entry of the word (the key) and the matching value which consists of a list of words that can follow the key.</p>
  
  <p>For example, the following sentence:</p>
  
  <p>"I think you think he will think it pretty"</p>
  
  <p>gives the following output:</p>
  
  <pre><code>{'': ['I'], 'I': ['think'], 'it': ['pretty.'] (...) 'think': ['you', 'he', 'it'], 'he': ['will']}
  </code></pre>
  
  <p>As you can see the first entry <code>''</code> is a bit weird, but it is intended. I have to make the entry explicit in my code, the value is the list which only contains the first word of the text.
  Obviously, there is no entry in which 'pretty' is the key.</p>
  
  <p>I'm not really good at programming and I've been stuck on this exercise for more than a day now, this is pretty much all I have:</p>
  
  <pre><code>def fill_up_dict(words):
      style_dict = {}
      prev_word = ''  #empty string
           for word in words
           style_dict[prev_word]
      #at a total loss here
      return style_dict
  </code></pre>
  
  <p>Maybe you can see, but I'm trying to create a key list of all words, and then assign the values to their previous words. But whatever I do, it doesn't work in the slightest.</p>