[Tutor] the and command

max baseman dos.fool at gmail.com
Fri Aug 24 07:12:04 CEST 2007


hello 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, here is the program  it's choppy i needed it for a  
quick calculation so it's not pretty but it's not long:

n2=2
n3=3
n4=4
n5=5
n6=6
n7=7
l2=[]
l3=[]
l4=[]
l5=[]
l6=[]
l7=[]
while n2 < 100:
     l2.append(n2)
     n2=n2+2
while n3 < 100:
     l3.append(n3)
     n3=n3+3
while n4 < 100:
     l4.append(n4)
     n4=n4+4
while n5 < 100:
     l5.append(n5)
     n5=n5+5
while n6 < 100:
     l6.append(n6)
     n6=n6+6
while n7<100:
     l7.append(n7)
     n7=n7+7
possible=[]
for num in l2 and l3 and l4 and l5 and l6: # here seems to be the  
problem
     possible.append(num)
for a in possible:
     if a-1 in l7:
         print a







any help is great thanks



More information about the Tutor mailing list