How do I find every element that is in both of two other lists?
<p>Write a function commonElements(a1, a2) that takes in 2 tuples as arguments and returns a sorted tuple containing elements that are found in both tuples.</p>

<p>My task is :</p>

<pre><code>    &gt;&gt;&gt; commonElements((1, 2, 3), (2, 5, 1))
    (1, 2)
    &gt;&gt;&gt; commonElements((1, 2, 3, 'p', 'n'), (2, 5 ,1, 'p'))
    (1, 2, 'p')
    &gt;&gt;&gt; commonElements((1, 3, 'p', 'n'), ('a', 2 , 5, 1, 'p'))
    (1, 'p')
</code></pre>

<p>I tried to do it like this.</p>

<pre><code>def commonElements(a1, a2):
    return tuple(set(a1).intersection( set(a2) ))
</code></pre>

<p>Anyone know what my mistake is with the requirement?<br>
I can not pass.</p>
