If Statements
In the if statement python uses the or operator to connect the conditions in one expression.
Example :
Python3
# initializing variable a = 55 b = 33 # defining the condition if b > a: print ( "b is greater than a" ) elif a = = b: print ( "a and b are equal" ) else : print ( "a is greater than b" ) |
Output:
a is greater than b
Python or Keyword
Python OR is a logical operator keyword. The OR operator returns True if at least one of the operands becomes to be True.
Note:
- In Python or operator does not return True or False.
- The or operator in Python returns the first operand if it is True else the second operand.