Bool values are commonly produced by Python's relational operators, which can be used for comparing objects.
Operator | Description |
---|---|
== | value equality |
!= | value inequality |
< | less-than |
> | greater-than |
<= | less-than or equal to |
>= | greater- than or equal to |
>>> i=10
>>> i==10
True
>>> i!=10
False
>>> i<10
False
>>> i>10
False
>>> i<=10
True
>>> i>=10
True
>>>
== two object values are equal
is operator can be used to find whether two variables point same reference or not
Notice: x and z are pointing to same Reference
in is Evaluates to true if it finds a variable in the specified sequence and false otherwise