Logical Operator

LOGICAL OPERATOR IN PYTHON


Logical Operator are used to combine conditional statements. Logical operators are used to perform Logical operations.

There are Three logical operators in python
  1. and operator
  2. or operator
  3. 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

Popular posts from this blog

Python Operators

Python DataTypes