Is 1 > 2 ? Is it True or False ? We know its False. Let’s see if python knows the answer

In [1]: 1>2
Out[2]: False

In [3]: 1<2
Out[4]: True

In [5]: 1==1
Out[6]: True

Note that equality is represented by two equal to signs, if we represent it by just one equal to sign then python thinks you are trying a variable assignment and it will error. Try it out and let me know what the error is.

Python also supports string equality checks:

In [7]: 'hi' == 'bye'
Out[8]: False

Lets discuss some of the logic operators in python ( AND, OR )

In [9]: (1<2) and (2>3)
Out[10]: False

Notice that for the AND operator – both the conditions should be true for the result/output to be True, but for the OR operator any one of the conditions should be true for the output to be true.

In [11]: (1<2) or (2>3)
Out[12]: True

Now that we have some understanding on some Boolean operators, lets move on to statements ( IF, ELSE ) in the next part. Try out some more examples in your jupyter notebook and let me know if you face any errors, would be interesting to discuss them here.