Python Program To Demonstrate Logical Operators
Write Python code to demonstrate logical operators
# WAP to demonstrate logical operators a = True b = False print("\na :", a) print("b :", b) print("\na and b :", a and b) print("\na and a :", a and a) print("\nb and b :", b and b) print("\na or b :", a or b) print("\na or a :", a or a) print("\nb or b :", b or b) print("\nnot a :", not a) print("\nnot b :", not b)
Output:
a : True
b : False
a and b : False
a and a : True
b and b : False
a or b : True
a or a : True
b or b : False
not a : False
not b : True