Viewers: in countries Watching now:
Due to its power, simplicity, and complete object model, Python has become the scripting language of choice for many large organizations, including Google, Yahoo, and IBM. In Python 3 Essential Training, Bill Weinman demonstrates how to use Python 3 to create well-designed scripts and maintain existing projects. This course covers the basics of the language syntax and usage, as well as advanced features such as objects, generators, and exceptions. Example projects include a normalized database interface and a complete working CRUD application. Exercise files accompany the course.
Boolean values in Python are the special True and False objects.
So if I say 5 == 5, I get the True value back.
And if I say 7 < 5, I get the False value back.
So True and False are special values. They're actually of a Boolean class.
If I say, type(True)
So if I say True and False, like that, I get False. If I say True and True, I get True. If I say True or False, that's True. If I say False or False, that's False. So the and, and the or operators, the ones that are spelled out as words, are especially Boolean operators. These are different then the bitwise, and, or.
So if I say True & True, like this, I get True. The difference is that's a bitwise operator. I'm doing bitwise arithmetic, as opposed to simply Boolean arithmetic. I'm doing bitwise arithmetic, which is different then the Boolean operators. So the Boolean operators are and and or spelled out. And they're useful for things like this. If I have, say, two values a, b and they're 0, 1, and if I have another two values x, y and they're spelled out say 'zero', 'one', and I say x < y, which of course is False, and a < b, which of course is True, so I could say, if I wanted to, if a < b and x < y, of course, that won't be True print('yes') else: print('no') and it prints no.
And so here I'm combining these two Boolean values. a < b, will result in a Boolean value of True. x < y results in a Boolean value of False. And so if they're both True, which they're not, we would print('yes'). And if they're not both True then we'll print('no'). So this is where you use the Boolean operators. You use them when you're operating on two Boolean values. And you're get these Boolean values typically in a comparison operation, like less than, or greater than, or one of the comparison operators that we covered in our movie on comparison operators.
So that's the use of the Boolean operators, as opposed to the bitwise operators.
Find answers to the most frequently asked questions about Python 3 Essential Training .
Here are the FAQs that matched your search "" :
Sorry, there are no matches for your search "" —to search again, type in another word or phrase and click search.
Access exercise files from a button right under the course name.
Search within course videos and transcripts, and jump right to the results.
Remove icons showing you already watched videos if you want to start over.
Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.
Click on text in the transcript to jump to that spot in the video. As the video plays, the relevant spot in the transcript will be highlighted.