Various logical, boolean and comparison operations can be conducted in Python using simple codes such as shown below

For example, “1 == 2” is testing or whether 1 is equal to 2. The answer is obviously “False”. Similarly “x!=2 and y !=0” is testing whether both conditions are met, i.e. x is not equal to 2 and y is not equal to 0, which turns out be “False” as well in the below example as x is equal to 2.

Cheers!

### Like this:

Like Loading...

Pingback: Learn Python Step by Step | RP's Blog on data science