In article <553a5ded$0$12978$c3e8da3$54964...@news.astraweb.com>, Steven D'Aprano <steve+comp.lang.pyt...@pearwood.info> wrote: >On Sat, 25 Apr 2015 12:50 am, subhabrata.bane...@gmail.com wrote: > >> Dear Group, >> >> I am trying to understand the use of Boolean operator in Python. I am >> trying to write small piece of script, as follows, >> >> def input_test(): >> str1=raw_input("PRINT QUERY:") >> if "AND" or "OR" or "NOT" in str1: >> print "It is a Boolean Query" >> elif "AND" or "OR" or "NOT" not in str1: >> print "It is not a Boolean Query" >> else: >> print "None" > >First problem: why do you sometimes return "None"? You have two possible >answers: either something is a boolean query, or it is not. There is no >third choice. ("It's a boolean query, but only on Wednesdays.")
In the context of testcode where the OP is not knowing what is going on it is absolutely useful, and legit. His problem is that it is Wednesday and weird things happen. >Steven > -- Albert van der Horst, UTRECHT,THE NETHERLANDS Economic growth -- being exponential -- ultimately falters. albert@spe&ar&c.xs4all.nl &=n http://home.hccnet.nl/a.w.m.van.der.horst -- https://mail.python.org/mailman/listinfo/python-list