On Jan 2, 9:24 am, Eric Kangas <eric.c.kan...@gmail.com> wrote:
> for x in l1,l2:
>    if l1[x:x+1]==l2[x:x+1];
That semicolon gives you the syntax error, but correcting that only
exposes a runtime error. You should look at what your x is in the
loop.

If you write "for x in range(len(l1))" you are a little closer
already.

Most of the time, filtering jobs like this can be accomplished by one-
liners using the right list combination and iteration tools:

[c for c in enumerate(zip(l1,l2)) if c[1][0] ==c[1][1]]

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org

Reply via email to