Finding the common elements of a list
<p>Hi as per the <a href="http://stackoverflow.com/questions/3594514/how-to-find-most-common-elements-of-a-list">earlier post</a>.</p>

<p>Given the following list:</p>

<blockquote>
  <p>['Jellicle', 'Cats', 'are', 'black', 'and', 'white,', 'Jellicle', 'Cats', 'are', 'rather', 'small;', 'Jellicle', 'Cats', 'are', 'merry', 'and', 'bright,', 'And', 'pleasant', 'to', 'hear', 'when', 'they', 'caterwaul.', 'Jellicle', 'Cats', 'have', 'cheerful', 'faces,', 'Jellicle', 'Cats', 'have', 'bright', 'black', 'eyes;', 'They', 'like', 'to', 'practise', 'their', 'airs', 'and', 'graces', 'And', 'wait', 'for', 'the', 'Jellicle', 'Moon', 'to', 'rise.', '']</p>
</blockquote>

<p>I am trying to count how many times each word THAT STARTS WITH A CAPITAL appears and display the top 3.</p>

<p>I am not interested in words that do not start with a capital.</p>

<p>If a word appears multiple times, sometimes starting with a capital and sometimes not, only count the times it does with a capital.</p>

<p>THis is what my code looks like currently:</p>

<pre><code>words = ""
for word in open('novel.txt', 'rU'):
      words += word
words = words.split(' ')
words= list(words)
words = ('\n'.join(words)).split('\n')

word_counter = {}

for word in words:

        if word in word_counter:
            word_counter[word] += 1
        else:
            word_counter[word] = 1      
popular_words = sorted(word_counter, key = word_counter.get, reverse = True)
top_3 = popular_words[:3]

matches = []

for i in range(3):

      print word_counter[top_3[i]], top_3[i]
</code></pre>
