Grouping items in two lists
<p>Give these two lists:</p>

<pre><code>I[2]: list1 = ['r1', 'r1', 'r1', 'r2', 'r2', 'r3']

I[3]: list2 = [1,2,3,1,2,1]
</code></pre>

<p>What is the Pythonic way to construct the following dictionary?</p>

<pre><code>I[5]: mydict
O[5]: {'r1': {'n1': 1, 'n2': 2, 'n3': 3}, 'r2': {'n1': 1, 'n2': 2}, 'r3': 'n1'}
</code></pre>

<p>Thanks.</p>
