Python Keywords (True/False) - Part-II



True, False

True and False are Boolean Values, Let's check these below code..
Try to execute these in your machine.

>>> 1 == 1

True

>>> 5 > 3

True

>>> 10 <= 1

False

>>> 3 > 6

False

>>> True or False

True

>>> True and False

False


Output


True and False are the same as 1 and 0. Check the below example.


>>> True == 1

True

>>> False == 0

True

>>> True + True

2

>>> False + True

1

>>> False * True

0

>>>



We can also compare the strings as shown below.


Comments

Popular posts from this blog

Python Keywords