Easy-to-follow video tutorials help you learn software, creative, and business skills.Become a member
So we are going to talk about the logical values of true and false here, and for this purpose I have started up the Python Shell, which on the graphical interfaces will be called Idle, or if you're in a command-line interface, it's simply the Python interpreter. It gets you exactly the same interface. So, I'm going to start by creating couple of variables. We'll call them a and b, and we'll assign them values of zero and 1 a, b - 0, 1. And I'm going to say a==b, and so the double equal sign is the equality operator.
It tests for equality between two values, and it returns either True or False. In this case it returns False, and false is actually a keyword in Python, which is a Boolean value for False. So, if I say a < b, I will get the Boolean value True, or a > b, I'll get the Boolean value False. In fact, you can assign True and False to variables. I can say a = True, and if I type a by itself, I get True. If I type, type of a, you'll see it is class 'bool'.
So, True and False are objects of class 'bool,' and they are mutable objects of course. So, if I type id of a, I get an id, and if I assign b = True and type id of b, I get exactly the same id. In fact, if I simply type id of True id, I will get that id. So, true and false are Boolean objects, and they are very simple, and they're simply used for representing the Boolean values of true and false.
Get unlimited access to all courses for just $25/month.Become a member