Robotics & Artificial Intelligence
Explain relational operators in Python. Give one example for each.
Getting Started
1 Like
Answer
Relational Operators in Python:
| Operator Name | Operator | Description | Example (a = 5, b = 2) | Result |
|---|---|---|---|---|
| Equality (Is Equal to) | == | Returns true if a equals to b | a == b | False |
| Not Equal to | != | Returns true if a is not equals to b | a != b | True |
| Greater than | > | Returns true if a is greater than b | a > b | True |
| Greater than or equal to | >= | Returns true if a is greater than b or a is equals to b | a >= b | True |
| Less than | < | Returns true if a is less than b | a < b | False |
| Less than or equal to | <= | Returns true if a is less than b or a is equals to b | a <= b | False |
Answered By
2 Likes