How to return a list containing common elements with no duplicates
<pre><code>def common_elements(list1, list2):
    """
    Return a list containing the elements which are in both list1 and list2

    &gt;&gt;&gt; common_elements([1,2,3,4,5,6], [3,5,7,9])
    [3, 5]
    &gt;&gt;&gt; common_elements(["this","this","n","that"],["this","not","that","that"])
    ['this', 'that']
    """

    result = []
    for element in list1:
        if element in list2:
            result.append(element)
    return result
</code></pre>

<p>I have this so far but it returns with duplicates for example:</p>

<pre><code>common_elements(["this","this","n","that"],["this","not","that","that"])
</code></pre>

<p>Returns as: <code>['this', 'this', 'that']</code></p>
