Python Logical And Operator


In logical and Operator, If anyone condition is false the output will be false.

Logical and Operator doesn’t check the second condition if the first condition is false

Logical and Operator only check the second condition, if the first condition is true.

Explanation-

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