Is 1 > 2 ? Is it True or False ? We know its False. Let’s see if python knows the answer
In : 1>2 Out: False
In : 1<2 Out: True
In : 1==1 Out: 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 : 'hi' == 'bye' Out: False
Lets discuss some of the logic operators in python ( AND, OR )
In : (1<2) and (2>3) Out: 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 : (1<2) or (2>3) Out: 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.