Relational operators are used to compare two values or expressions. They return a boolean value (true or false) based on the comparison. Here are the common relational operators:
x < y: Less thanx <= y: Less than or equal tox > y: Greater thanx >= y: Greater than or equal tox == y: Equal tox != y: Not equal
You can also combine these operators to form more complex boolean expressions using and, or, and not.
Examples:
if b >= a and b <= c:
print('b is between a and c')
if not (b < a or b > c):
print('b is still between a and c')
In these examples, the conditions check the relationship between the variables a, b, and c, and execute the print statements based on the results of the comparisons.
