[Tutor] multiple if and or statement

Mike Franon kongfranon at gmail.com
Mon Mar 14 20:41:19 CET 2011


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 once correct?


Thanks in advance


More information about the Tutor mailing list