1
00:00:00,430 --> 00:00:05,710
One more type of data type you should be aware of will be the boolean

2
00:00:05,869 --> 00:00:11,399
operations or the boolean values. Typically, it's gonna be two of them.

3
00:00:11,409 --> 00:00:13,939
You either have true or false

4
00:00:14,210 --> 00:00:19,500
and it will depend largely on the outcome of certain kinds of operations.

5
00:00:19,510 --> 00:00:20,579
Now, as an example

6
00:00:21,399 --> 00:00:27,239
over here, I have the variable X equals five, the variable Y equals 10.

7
00:00:27,440 --> 00:00:31,899
Now I have my very first print function in here that says X

8
00:00:32,139 --> 00:00:34,139
is equal to Y.

9
00:00:34,430 --> 00:00:37,299
The second is X is less than Y.

10
00:00:37,680 --> 00:00:38,259
So

11
00:00:38,770 --> 00:00:42,349
with booleans, you either have true or false.

12
00:00:42,360 --> 00:00:45,549
Now, what do you think the answer for the very first print would be?

13
00:00:45,889 --> 00:00:46,159
Well,

14
00:00:46,169 --> 00:00:50,409
the answer obviously would be false because five is not equal to 10 while

15
00:00:50,419 --> 00:00:55,720
the second should be true because X is in fact less than Y.

16
00:00:55,729 --> 00:00:58,310
So now if I go ahead and run this program,

17
00:00:58,819 --> 00:01:01,590
now you can see we have false and true.

18
00:01:01,840 --> 00:01:05,790
These are what we refer to as the boolean values or the boolean

19
00:01:06,569 --> 00:01:07,760
operators.

20
00:01:07,949 --> 00:01:09,819
And we typically use them whenever we're

21
00:01:09,830 --> 00:01:12,910
trying to create loops or conditional statements.

22
00:01:12,919 --> 00:01:13,550
Don't worry

23
00:01:13,669 --> 00:01:16,550
we're going to talk about those in the next section.

24
00:01:16,809 --> 00:01:21,389
But typically, we may want to write a program that will check to see if something

25
00:01:21,580 --> 00:01:22,790
has happened

26
00:01:23,069 --> 00:01:25,989
and then if it has happened, meaning if it's true,

27
00:01:26,120 --> 00:01:28,989
then do something. Or we can also say

28
00:01:29,199 --> 00:01:31,269
if this thing hasn't happened.

29
00:01:31,650 --> 00:01:35,059
Therefore, if it is false, then do something else.

30
00:01:35,089 --> 00:01:36,500
So we're going to be making use of boolean

31
00:01:36,690 --> 00:01:39,919
operators and values a bit later.

32
00:01:40,330 --> 00:01:40,949
But

33
00:01:41,620 --> 00:01:42,529
the thing about boolean

34
00:01:42,750 --> 00:01:44,569
values and operations is that

35
00:01:44,879 --> 00:01:49,680
they work with the comparison operators like your equals

36
00:01:49,690 --> 00:01:52,949
to less than is equal to and so on.

37
00:01:53,069 --> 00:01:57,750
But we also have what we call the logical operators,

38
00:01:57,980 --> 00:02:00,480
logical operators will be things like and

39
00:02:00,589 --> 00:02:02,430
or, or not.

40
00:02:02,650 --> 00:02:04,959
So as an example, let me give you

41
00:02:05,419 --> 00:02:06,120
another

42
00:02:06,470 --> 00:02:08,788
program in here. Let me, first of all say A

43
00:02:09,320 --> 00:02:11,500
uh equals true.

44
00:02:12,419 --> 00:02:13,039
OK?

45
00:02:13,839 --> 00:02:16,550
And then B equals false.

46
00:02:16,929 --> 00:02:19,970
By the way, please note that

47
00:02:20,279 --> 00:02:23,289
the true and false here are not strings

48
00:02:24,029 --> 00:02:25,929
and in all strings because you can see that

49
00:02:26,339 --> 00:02:27,729
it starts with a capital T

50
00:02:28,539 --> 00:02:31,309
and with the false, it starts with a capital F.

51
00:02:31,320 --> 00:02:35,399
So Python automatically knows that OK, you're dealing with booleans in here.

52
00:02:35,649 --> 00:02:36,160
So

53
00:02:36,380 --> 00:02:40,470
if I wanted to write a print function in here that says something like let's say

54
00:02:41,360 --> 00:02:41,910
A

55
00:02:42,960 --> 00:02:43,779
and

56
00:02:43,990 --> 00:02:44,619
B,

57
00:02:45,289 --> 00:02:50,580
let me write another one prints, let's say A or B

58
00:02:51,139 --> 00:02:53,270
and then the last one prints

59
00:02:54,020 --> 00:02:56,529
and I'm gonna say, let's say not a.

60
00:02:57,399 --> 00:03:00,899
What do you think the answers will be for this three?

61
00:03:01,220 --> 00:03:04,460
Typically whenever you're dealing with the logical operators

62
00:03:05,080 --> 00:03:06,220
and you're comparing

63
00:03:06,679 --> 00:03:08,910
two or more values,

64
00:03:09,100 --> 00:03:14,929
all of them will need to be true whenever you're using the end statement.

65
00:03:14,990 --> 00:03:19,419
If one of them is false, then the answer will be false. OK?

66
00:03:19,710 --> 00:03:21,419
The opposite is with all.

67
00:03:21,880 --> 00:03:25,380
So if you're saying true or false, it's going to be true.

68
00:03:26,020 --> 00:03:28,990
If it's true and false, the answer will be false.

69
00:03:29,110 --> 00:03:30,779
And then obviously, for the last one in here,

70
00:03:30,789 --> 00:03:35,360
not a would be false because not a means the opposite of true,

71
00:03:35,619 --> 00:03:37,339
opposite of true is false. So

72
00:03:37,490 --> 00:03:39,630
if I run the program right now,

73
00:03:39,899 --> 00:03:42,809
you will see once again that A and be true and false

74
00:03:42,820 --> 00:03:47,600
will always be false while true or false will be true,

75
00:03:47,610 --> 00:03:49,350
while not A

76
00:03:49,589 --> 00:03:51,759
will be false.

77
00:03:51,850 --> 00:03:56,600
So once again Bullen operators and values, they work with logical operators as well

78
00:03:56,850 --> 00:03:59,279
such as your end or or not.

79
00:03:59,399 --> 00:04:00,009
And of course,

80
00:04:00,020 --> 00:04:02,429
your comparison operators such as your equals to

81
00:04:02,440 --> 00:04:05,559
or is not equal to less than greater than

82
00:04:05,850 --> 00:04:07,330
and so on.

83
00:04:07,470 --> 00:04:08,800
So we're going to be working with boolean

84
00:04:08,919 --> 00:04:11,740
operators as we progress in the course. Thank you for watching.

85
00:04:11,750 --> 00:04:13,229
I will see you in the next class.

