Comparison Operators

Comparison operators are used to compare values. It returns either True or False after computing the condition. 
 

Operator Meaning Example
> Greater than – True if left operand is greater than the right x > y
< Less than – True if left operand is less than the right\\\ x < y
== Equal to – True if both operands are equal x == y
!= Not equal to – True if operands are not equal x != y
>= Greater than or equal to – True if left operand is greater than or equal to the right x >= y
<= Less than or equal to – True if left operand is less than or equal to the right x <= y

 

Understanding Boolean Logic in Python 3

Booleans are simple and easy to use concepts that exist in every programming language. A boolean represents an idea of “true” or “false.” While writing an algorithm or any program, there are often situations where we want to execute different code in different situations. Booleans help our code to do just that easy and effective. More often, a boolean value is returned as a result of some kind of comparison operations.
There are two Boolean keywords: True and False
Operators : Operators are special symbols in Python that is used to perform arithmetic or logical computations. The values on which operation is to be done are called operands.while the operation is denoted by operator(eg. +, -, /, *, %, etc.)
 

Similar Reads

Comparison Operators

Comparison operators are used to compare values. It returns either True or False after computing the condition....

Logical Operators

There are Three Logical operators: and, or, not...

Truth Table

A Truth Table is a small table that allows us, to give the results for the logical operators.and Table : It takes two operands....

Contact Us