In life, we compare things. In writing, we use symbols like <, >, and = to tell that one thing is greater, less than, or equal to another.
Python uses the usual logical comparison symbols we use in mathematics, with some bit changes:
Equals: x == y
This means x and y are equal or have the same value.
Not Equals: x != y
This means x and y have values that are not the same or not equal.
Less than: x < y
This means that the value of x is less than the value of y.
Less than or equal to x <= y
This is as straightforward as it looks. It means x may be either greater than or equal to y.
Greater than: x > y
This shows that x is greater than the value of y.
Greater than or equal to x >= y
We can use these comparisons and symbols in several ways, most commonly in conditions and loops.
Now, let us discuss how conditions work in Python: