How the Python or Operator Works
00:00
In your preceding lessons, we got a bit of a background about Boolean logic and some of the terms that apply to Boolean operators in Python. In this next set of lessons, we’ll actually take a look at how Python uses the or operator.
00:16 Generally, the OR of two Boolean expressions is true if at least one of the two expressions is true.
00:25 This is sometimes referred to as the inclusive OR. It leads to a little bit of confusion because in English the word “or” can have two meanings. Sometimes when we say “or” we mean one or the other but not both.
00:39
That’s called the exclusive OR. But in Boolean algebra, Boolean logic, and the way Python understands the word or, we use the inclusive OR, which means all we need is at least one of the two expressions to be True. If they’re both True, the or of those two expressions is also True.
01:01 We’ll take a look at some specific examples in Python code starting in your next lesson.
Become a Member to join the conversation.
