Definition:
The sign of the logical operator is and.
It checks the condition of true or false between two variables, where the condition will be either true or false.
The operands can be either variables or values.
It checks the condition before executing the process.
So, it is called the AND operator.
Syntax:
if condition1 and condition2:
# code to run if both are True
Example:
x = 15
y = 14
if x > 0 and y > 5:
print("Both conditions are true")
Output:
Note: If you apply this operator between two conditions, both conditions should be true to print the output.
Exercise
Use the AND Logical Operator to check if a = 10 is greater than 5 and b = 20 is less than 25, then print "Both conditions are true".
