I want this function to loop through both lists and return the object that is the same in both
<p>These are the lists; note how the second list is made up of objects that need splitting first.  </p>

<pre><code>gaps = ['__1__', '__2__', '__3__']
questions = ['Bruce Wayne is __1__', 'Clark Kent is __2__', 'Barry Allen is __3__']
</code></pre>

<p>Here's the code. It seems to work only for the first (zeroth) object, bud that's it - it doesn't even loop.</p>

<pre><code>def is_gap(question, gap):
place = 0
while (place &lt; 3):
    question[place] = question[place].split(' ')
    for index in gaps:
            if index in question[place]:
                return index
            else:
                return None
place += 1
print is_gap(questions, gaps)
</code></pre>

<p>Python stops executing as soon as it hits a return statement. If you return inside a loop, it'll stop running after one iteration, when it hits the first return statement.</p>

python list