Python function checking for common elements using function
<p>The goal is to take two lists see if any elements match and if they do add 1 to count every time. The first list is a list of 5 elements and the second is user input. It doesn't work , what am I doing wrong? It has to be done using a function please help.</p>

<pre><code>userask = input("Enter a few numbers to try win the lotto:      ")


def count_correct(list1,list2):


    count = 0
    for r in list2:
        if list1 in list2:
                count += 1

    return count
</code></pre>

<p>Your code is incomplete here. But I think this change should help you.</p>

<p>Don't use <code>if list1 in list2:</code>, use <code>if r in list2:</code></p>

python