Re: [Tutor] multiple if and or statement

2011-03-14 Thread bob gailer
On 3/14/2011 3:13 PM, Mike Franon wrote: Thank you everyone who responded, very fast responses I am impressed. OK now I see where I went wrong and had to do if (i == 'test1') or (i=='test2'): I guess I was thinking if I do a = ['test1', 'flag', 'monday'] for i in a: It would check each it

Re: [Tutor] multiple if and or statement

2011-03-14 Thread Emile van Sebille
On 3/14/2011 1:13 PM Mike Franon said... Thank you everyone who responded, very fast responses I am impressed. OK now I see where I went wrong Well, no, I don't think so. Your first test was: if i=='test1' or 'test2': which evaluates as true if _either_ i=='test1' _or_ 'test2' so, the fi

Re: [Tutor] multiple if and or statement

2011-03-14 Thread Mike Franon
Thank you everyone who responded, very fast responses I am impressed. OK now I see where I went wrong and had to do if (i == 'test1') or (i=='test2'): I guess I was thinking if I do a = ['test1', 'flag', 'monday'] for i in a: It would check each item in the list one at a time like a loop I

Re: [Tutor] multiple if and or statement

2011-03-14 Thread Marc Tompkins
On Mon, Mar 14, 2011 at 12:41 PM, Mike Franon wrote: > HI, > > I had a question, when running this small snippet of test code: > > > > a = ['test1', 'flag', 'monday'] > > for i in a: >if i == 'test1' or 'test2': > print 'true' > > > It always prints true > > > $ ./testing.py > true > tr

Re: [Tutor] multiple if and or statement

2011-03-14 Thread Adam Bark
On 14/03/11 19:41, Mike Franon wrote: HI, I had a question, when running this small snippet of test code: a = ['test1', 'flag', 'monday'] for i in a: if i == 'test1' or 'test2': print 'true' It always prints true $ ./testing.py true true true I know I am missing something,

Re: [Tutor] multiple if and or statement

2011-03-14 Thread Corey Richardson
On 03/14/2011 03:41 PM, Mike Franon wrote: > HI, > > I had a question, when running this small snippet of test code: > > > > a = ['test1', 'flag', 'monday'] > > for i in a: > if i == 'test1' or 'test2': if i == 'test1' or i == 'test2' >print 'true' > I know I am missing something

[Tutor] multiple if and or statement

2011-03-14 Thread Mike Franon
HI, I had a question, when running this small snippet of test code: a = ['test1', 'flag', 'monday'] for i in a: if i == 'test1' or 'test2': print 'true' It always prints true $ ./testing.py true true true I know I am missing something, but in reality it should only print true