Alan Gauld wrote: > "max baseman" <[EMAIL PROTECTED]> wrote >> im checking if a number is in all 5 of the other lists and when >> i use the and command it seems to just be checking if it's in a >> least >> one of the others, > > >> for num in l2 and l3 and l4 and l5 and l6: # here seems to be the > > Try: > > if num in I2 and num in I3 and num in I4 and num in I5 and num in I6: >
or also : if num in l1 + l2 + l3 + l4 + l5 : > In your case you are 'and'ing the lists which is a boolean expression > and because of how Python does short circuit evaluation it returns > the last list > >>>> a = [1,2] >>>> b = [3,4] >>>> a and b > [3, 4] > > so > > for n in a and b: > > is the same as > > for n in b: > > which iterates over b... > > HTH, > _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor