title: Get last three letters in dict python
body: <p>An example like:</p>
  
  <pre><code> text = ' "west best worst first tapping snapping in a pest the straining 
   singing forest living'
   a_dict = get_last_three_letters_dict(text) 
   remove_less_than_2(a_dict)
   print("1.")
   print_dict_in_key_order(a_dict)    
  
   text = 'Kublai Khan does not necessarily believe everything Marco Polo says 
   when he describes the cities visited on his expeditions but the emperor of 
   the Tartars does continue listening to the young Venetian with greater 
   attention and curiosity than he shows any other messenger or explorer of his'
   a_dict = get_last_three_letters_dict(text) 
   remove_less_than_2(a_dict)
   print("2.")
   print_dict_in_key_order(a_dict)
  </code></pre>
  
  <p>I'm trying to convert the string to lower case and then returns a dictionary object which has keys which are the last three letters of any words in the string of text with length greater than 2, and corresponding values which are the number of words in the parameter string of text which end with these last three letters.</p>
  
  <p>The testing code removes any pairs in the resulting dictionary where the last three letters occur just the once in the string of text, I tried the function below, it doesn't work.</p>
  
  <pre><code>def get_last_three_letters_dict(sentence):
        sentence = dict(sentence)
        tails = []
        for letter in sentence:
              if len(name) &gt; 2:
                 tails.append(name[-3:].lower())
        return (''.join(tails) + ":")
  </code></pre>
  
  <p>expected:</p>
  
  <pre><code> 1.
   est : 4
   ing : 5
   rst : 2
  
   2.
   han : 2
   his : 2
   ing : 2
   oes : 2
   the : 4
  </code></pre>