Python Logical Or Operator


In logical or Operator, If anyone condition is true the output will be true.

Logical or Operator doesn’t check the second condition if the first condition is true

Logical or Operator only check the second condition, if the first condition is false.

Explanation-

  • true & false = true
  • false & true = true
  • false & false = false
  • true & true = true.
Program
x=15; y=25; z=35; print(x<y or x<z) #true or true =true print(x<y or x>z) #true or false =true print(x>y or x<z) #false or true =true print(x>y or x>z) #false or false =false
Input
Output