Hello, Stellar Navigator! Today, we're diving into Python Comparison Operators. These operators allow us to compare two values, yielding a boolean
result — True
or False
. Our goal is to understand these operators and become comfortable with operator chaining. Are you ready? Let's delve in!
Comparison operators in Python are used to compare two values and yield a boolean
outcome. The comparison operators in Python are:
- Equal to (
==
)- Note that
=
and==
are two different operators - the former is an assignment operator (e.g.,variable = 2
), and the latter is the equality comparison.
- Note that
- Not equal to (
!=
) - Greater than (
>
) - Less than (
<
) - Greater than or equal to ()
