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>You may use <a href="https://docs.python.org/2/library/collections.html#collections.Counter" rel="nofollow"><code>collections.Counter()</code></a> to achieve this. Example:</p>

<pre><code>&gt;&gt;&gt; x = [1,2,3,4,1,1,2,3]
&gt;&gt;&gt; my_list = Counter(x).items()
&gt;&gt;&gt; my_list
[(1, 3), (2, 2), (3, 2), (4, 1)]

# In order to sort the list base based on value of tuple at index `1` and then index `0`
&gt;&gt;&gt; sorted(my_list, key=lambda x: (x[1], x[0]))
[(4, 1), (2, 2), (3, 2), (1, 3)]
</code></pre>

python python-3.x