Re: Boolean Operator Confusion

2015-05-08 Thread Albert van der Horst
In article <553a5ded$0$12978$c3e8da3$54964...@news.astraweb.com>, Steven D'Aprano 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 fol

Re: Boolean Operator Confusion

2015-04-24 Thread Rustom Mody
On Saturday, April 25, 2015 at 6:52:53 AM UTC+5:30, Mark Lawrence wrote: > On 25/04/2015 01:51, Terry Reedy wrote: > > > > Based on my experience reading newbie posts on python list and > > Stackoverflow, learning to write real functions, without input and > > print, and repeatable tests, is the mo

Re: Boolean Operator Confusion

2015-04-24 Thread Mark Lawrence
On 25/04/2015 01:51, Terry Reedy wrote: Based on my experience reading newbie posts on python list and Stackoverflow, learning to write real functions, without input and print, and repeatable tests, is the most important thing many people are not learning from programming books and classes. G

Re: Boolean Operator Confusion

2015-04-24 Thread Rustom Mody
On Saturday, April 25, 2015 at 6:21:56 AM UTC+5:30, Terry Reedy wrote: > Functions that do real calculation should be written as functions that > take an input object (or objects) and produce an output object. > Based on my experience reading newbie posts on python list and > Stackoverflow, l

Re: Boolean Operator Confusion

2015-04-24 Thread Terry Reedy
On 4/24/2015 10: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:

Re: Boolean Operator Confusion

2015-04-24 Thread Tim Chase
On 2015-04-24 09:00, Ian Kelly wrote: > It is not equivalent to: > > if ("AND" in str1) or ("OR" in str1) or ("NOT" in str1): Which python allows you to write nicely as if any(term in str1 for term in ["AND", "OR", "NOT"]): The use of any()/all() has certainly improved the readability of

Re: Boolean Operator Confusion

2015-04-24 Thread subhabrata . banerji
On Friday, April 24, 2015 at 8:45:04 PM UTC+5:30, Steven D'Aprano wrote: > On Sat, 25 Apr 2015 12:50 am,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(): > >

Re: Boolean Operator Confusion

2015-04-24 Thread Steven D'Aprano
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

Re: Boolean Operator Confusion

2015-04-24 Thread Ian Kelly
On Fri, Apr 24, 2015 at 8:50 AM, 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: This

Boolean Operator Confusion

2015-04-24 Thread subhabrata . banerji
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