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, but in reality it should only print
> true once correct?

You are missing something. Before, you're simply testing the existence
of 'test2'. And since 'test2' is an immediate value (so to speak), it
always exists.

-- 
Corey Richardson
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to