Bitwise operators include the standard bitwise booleans, AND, OR, and XOR, plus operators for shifting bits left and right.
- [Instructor] These are Python's Bitwise Operators.…There's And, Or, Xor, Shift left, and Shift right.…These operators operate on bits.…They are not the logical operators…used for the conditional constructs.…These are bitwise operators that operate on numbers,…and they operate on the individual bits in the numbers.…We'll take a look now at how that works.…Here in Komodo,…I've opened a working copy of bitwise.py…from chapter five of the exercise files.…
And I'm just going to go ahead and run this…so you can see what it is that's going on…before we talk about the individual operators.…If you come down here,…I have two variables: x and y.…And these variables are initialized…using hexadecimal literal numbers.…And so the first one is 0a…and the second one is 02…and then I'll operate on them using an operator,…in this case it's the And operator.…And then I printed out twice,…once in hexadecimal and once in binary.…
And you'll notice that I'm using f-string,…and I'm using these format controls,…these format specifiers,…
- 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.