[Tutor] Finding the differences between two lists

Andre Engels andreengels at gmail.com
Thu Aug 25 21:49:28 CEST 2011


On Thu, Aug 25, 2011 at 9:08 PM, Justin Wendl <justin.wendl at gmail.com>wrote:

> Hi John,
>
> Thanks for the quick response.  Unfortunately it is returning the same
> result..
>
>
This is caused by the

else:
    break

part of the the code. Break breaks out of the loop, thus you skip all
following elements if you go through the 'else' part once. What you probably
meant was:

else:
    continue

This skips only the remainder of the current traversion of the loop, and
goes on with the next one.

In this case it's even simpler: There is no remainder of the current run of
the loop to skip, so you should be allright if you remove the else part
altogether.

-- 
André Engels, andreengels at gmail.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20110825/9d79f08f/attachment.html>


More information about the Tutor mailing list