Logical Operator
- and operator
- or operator
- not operator
1.and operator:- It return True if both statements are true otherwise return false.
Example:
x=5
y=10
print(x<y and y>x)
Output:True
2.or operator:- It return True if one of the statements is true. If all statements are false then it return false as output.
Example:
x=5
y=10
print(x<y or y<x)
Output: True
3.not operator:- It reverse the result return false if the result is True.
Example:- x=5
y=10
print(not(y>x and x<y))
Output: False
Comments
Post a Comment