Create Scripts and Maintain Existing Projects with Python 3


show more Specifying logical values with True and False provides you with in-depth training on Developer. Taught by Bill Weinman as part of the Python 3 Essential Training show less
please wait ...

Specifying logical values with True and False

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 cl...

Specifying logical values with True and False
Video duration: 1m 40s 6h 36m Beginner

Viewers:

Specifying logical values with True and False provides you with in-depth training on Developer. Taught by Bill Weinman as part of the Python 3 Essential Training

Subjects:
Developer Web
Software:
Python
Author:
please wait ...