python - Letter Count Dict
<p>Write a Python function called <code>LetterCount()</code> which takes a string as an argument and returns a dictionary of letter counts. </p>

<p>The line:</p>

<pre><code>print LetterCount("Abracadabra, Monsignor")
</code></pre>

<p>Should produce the output:</p>

<pre><code>{'a': 5, 'c': 1, 'b': 2, 'd': 1, 'g': 1, 'i': 1, 'm': 1, 'o': 2, 'n': 2, 's': 1, 'r': 3}
</code></pre>

<p>I tried:</p>

<pre><code>import collections
c = collections.Counter('Abracadabra, Monsignor')
print c
print list(c.elements())
</code></pre>

<p>the answer I am getting looks like this</p>

<pre><code>{'a': 4, 'r': 3, 'b': 2, 'o': 2, 'n': 2, 'A': 1, 'c: 1, 'd': 1, 'g': 1, ' ':1, 'i':1, 'M':1 ',':1's': 1, }
['A', 'a','a','a','a','c','b','b','d','g', and so on 
</code></pre>

<p>okay now with this code 
import collections
c = collections.Counter('Abracadabra, Monsignor'.lower())</p>

<p>print c
am getting this
 {'a': 5, 'r': 3, 'b': 2, 'o': 2, 'n': 2, 'c: 1, 'd': 1, 'g': 1, ' ':1, 'i':1, ',':1's': 1, }</p>

<p>but answer should be this 
 {'a': 5, 'c': 1, 'b': 2, 'd': 1, 'g': 1, 'i': 1, 'm': 1, 'o': 2, 'n': 2, 's': 1, 'r': 3}</p>
