How do I return a list of tuples with each unique string and its count given a list of strings?
<p>Not sure where to start...
item() gives a dictionary and I don't want that.</p>

<p>I would say I need to loop through the list....</p>

<p>Please someone give me some hints so I can get started!</p>

<p>EDIT:</p>

<pre><code>count_of_names(names)

    counts_of_names(['John', John', 'Catherine', 'John', 'Christopher', 'Catherine']' 
</code></pre>

<p>output:</p>

<pre><code>[('Catherine', 2), ('Christopher', 1), ('John', 3)] 
</code></pre>

<p>Use <code>set</code> and list comprehension:</p>

<pre><code>def counts_of_names(names):
    return [(name, names.count(name)) for name in set(names)]
</code></pre>

python python-3.x