The boolean operators are different than the bitwise operators. These are used in the context of conditional expressions.
- [Instructor] These are Python's Boolean Operators.…It's an interesting set because it includes…the traditional and, or, not.…It does not have the traditional XOR,…which is not hard to create on your own.…And it has a few others for testing…if a value is in a set or not in a set,…or if testing the identity of two operands…whether they're the same object…or if they're not the same object.…So it's a little different than you might be used to…in some other languages, but it's all very useful.…
Let's take a look at how these work.…Here in Komodo I've opened a working copy…of boolean.py from chapter five of the exercise files.…You notice we have some variables set up here…starting on line four and then starting on line nine…we have an if else.…The condition uses these Boolean Operators.…In this case we're testing A and B,…which is true and false, the result of which will be false…because for and to be satisfied…they would both have to be true.…When I save this and run it, you see expression is false.…
I change this operator to or, A or B.…
- Python anatomy
- Types and values
- Conditionals and operators
- Building loops
- Defining functions
- Python data structures: lists, tuples, sets, and more
- Creating classes
- Handling exceptions
- Working with strings
- File input/output (I/O)
- Creating modules
- Integrating a database with Python db-api
Skill Level Intermediate
Python: Programming Efficiently (2017)with Michele Vallisneri2h 15m Intermediate
2. Language Overview
3. Types and Values
8. Structured Data
11. String Objects
12. File I/O
13. Built-in Functions
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.