6 Dec 2020

Boolean values


                                           Boolean data type have two values. They are 0 and 1. 0 represents False, 1 represents True. True and False are keyword . Boolean expressions is an expression that is either true or false. It use the operator == to compare two operands which produces true if the both operands are equal ,false  otherwise.

Program:

>>> 3==5
 False
>>> 6==6 
True
>>> True+True
2
>>> False+True
1
>>> False*True
0

No comments:

Post a Comment

Operator precedence

           When an expression contains more than one operator, the order of evaluation depends on the order of operations.            The ac...