Booleans in Python(Comparison operators)

For the following quiz questions, we will get a preview of comparison operators. In the table below, a=3 and b=4.

Operator Description Example
== If the values of two operands are equal, then the condition becomes true. (a == b) is not true.
!= If values of two operands are not equal, then condition becomes true. (a != b) is true.
> If the value of left operand is greater than the value of right operand, then condition becomes true. (a > b) is not true.
< If the value of left operand is less than the value of right operand, then condition becomes true. (a < b) is true.
>= If the value of left operand is greater than or equal to the value of right operand, then condition becomes true. (a >= b) is not true.
<= If the value of left operand is less than or equal to the value of right operand, then condition becomes true. (a <= b) is true.

2 > 3             – False

# Answer this question by using above table
3 <= 2
3 == 2.0
3.0 == 3
4**0.5 != 2

Leave a comment