Part One
Comparison Operators
Comparison operators compare two values and return True or False.
== equal, != not equal, > greater than, < less than, >= greater or equal, <= less or equal.
= means assignment, while == means comparison.
Part Two
Boolean Operators
Boolean operators combine conditions.
and: both conditions must be True. or: at least one condition must be True. not: flips True to False (and False to True).
Part Three
Combining Conditions in Real Examples
In real programs, we usually combine comparison operators with boolean operators inside if statements.
and, or, or not.
Part Four
Identity and Membership Operators
is and is not check identity (whether two names refer to the same object). in and not in check membership (whether a value exists inside a sequence or set).
Chapter Navigation
Move between chapters.