2.2.Logical operator

and – (a and b) is true

or – (a or b) is true

not – Not(a and b) is false.

###################################################
#Logical operator - Two conditional expressions
###################################################
a = 0
b = 1
#If both the operands are true then condition becomes true.
if a == 0 and b == 1:
print "(a and b) is true"
#If any of the two operands are true then condition becomes true.
if a == 0 or b == 1:
print "(a or b) is true"
#Used to reverse the logical state of its operand.
if not(a == 0 and b == 1):
print "Not(a and b) is true."
##################################################
#Logical operator - Three conditional expressions
##################################################
a = "a"
b = "a"
c = "a"
if a == "a" and b == "b" and c =="c":
print "(a and b and c) is true"
if a == "a" or b == "b" or c =="c":
print "(a or b or c) is true"
if not(a == "a" and b == "b" and c =="c"):
print "Not(a and b and c) is true."