boolian logic

duncan smith buzzard at urubu.freeserve.co.uk
Fri Jun 13 05:43:14 EDT 2008


marc wyburn wrote:
> HI all, I'm a bit stuck with how to work out boolian logic.
> 
> I'd like to say if A is not equal to B, C or D:
>    do something.
> 
> I've tried
> 
> if not var == A or B or C:
> and various permutations but can't seem to get my head around it.  I'm
> pretty sure I need to know what is calulated first i.e the not or the
> 'OR/AND's
> 
> thanks, Marc.

There's a number of ways of coding it.  How about,

if not var in [A, B, C]:
     #do stuff


Duncan



More information about the Python-list mailing list