Using the Python or Operator (Overview)
There are three Boolean operators in Python: and, or, and not. With them, you can test conditions and decide which execution path your programs will take. In this tutorial, you’ll take a deep dive into the Python or operator and how to use it.
By the end of this course, you’ll have learned:
- How the Python
oroperator works - How to use the Python
oroperator in Boolean and non-Boolean contexts - What kind of programming problems you can solve by using
orin Python - How to read and better understand other people’s code when they use some of the special features of the Python
oroperator
You’ll learn how to use the Python or operator by building some practical examples. Even if you don’t really use all the possibilities that the Python or operator offers, mastering it will allow you to write better code.
00:00
Welcome to this course on how to use the Python or operator.
00:05
or is one of the three Boolean operators in Python. The other two are and or not. We use Boolean operators to control the flow of our program, typically in if statements and while loops.
00:18
In this course, you will learn how the Python or operator works, you’ll learn how to syntactically use it in both Boolean and non-Boolean contexts, you’ll figure out where you would want to use it in particular situations, and you’ll learn how to read other people’s code that have taken advantage of how Python executes an or operation to do some fairly cool programming.
00:44
We’ll get started with a little bit of background on the or operator.
Become a Member to join the conversation.
