Checking if something is true in all iterations of a Python for loop
<p>I'm trying to find is a variable is an element of any lists in a list of lists.  If it is an element of any of them, then I'm using <code>continue</code> to move onto the next block.  If it's not a member of any lists I would like to then create a new list in the list of lists, with the variable as the only entry of that list.</p>

<p>The reason I'm asking is because with either the if statement being satisfied, or with none of the else iterations being satisfied, both situations see the same outcome, a continuation past this block.</p>

<pre><code>for group in groups:
    if point in group:
        continue
    else:

        # if point not an element of any group, 
          create group in groups with variable as only element
</code></pre>

<p>Update:</p>

<p>Would this work?  Is there a more succinct way to do it?</p>

<pre><code>for group in groups:
    if point in group:
        groupCheck = 1
    else:
        pass
if not groupCheck:
    # Create a new list including point
</code></pre>

<p>Why not just put the if statement outside of the loop?</p>

<pre><code>found = False

for group in groups:
    if point in group:
        found = True
        break

if not found:
    groups.append([point])
</code></pre>

python