Logical operator in python full tutorial | Python Bootcamp

Introduction

Logical operator in python: In this post, you will learn about the logical operators in python and also you will see an example on it and below is the video format of the post, check it out ????????

Video:

What is the logical operator in python ❓

The logical operator in python are like a conditional statement like true or false.

There are three types of logical operators they are;

  1. AND
  2. OR
  3. NOT

Let’s see about all these operators in detail ????????????

AND:

The AND operator needs both the possibility to be true and then only the AND operator will be true. In simple words, True if both the operands are true.

eg: AND operator,

A and B ???? Both the A and B should be true and then only the line will be true.

The result ????????

Logical operator in python

2. OR:

True if either of the operands is true, In simple words, if A and B are true then they are true. If A is true and B is false then also it is true. Only if both A and B are false all will be false.

The result ????????

Logical operator in python

3. Not

True if operand is false. Let me break it down into simple words. If A is true then it is not true it is false.

Logical operator in python

Obviously, if a is greater than 12 it must be false but if I enter the not logical operator then it becomes true.


Also Read: Ordering pizza in python full tutorial for beginners

Also Read: Adding two numbers n python full tutorial