1
00:00:00,590 --> 00:00:01,430
Hello, dear friends.

2
00:00:01,910 --> 00:00:06,680
In this lesson, we will learn operators as a concept in Python.

3
00:00:07,190 --> 00:00:07,940
So let's start.

4
00:00:08,270 --> 00:00:09,170
So what does this mean?

5
00:00:09,320 --> 00:00:10,250
Operators?

6
00:00:11,060 --> 00:00:18,020
Well, basically, operators are the constructs which can manipulate the value of operands.

7
00:00:18,650 --> 00:00:19,850
OK, you already knew that.

8
00:00:19,850 --> 00:00:21,170
But how do they do that?

9
00:00:21,810 --> 00:00:22,550
Let's have a look.

10
00:00:23,930 --> 00:00:29,030
For example, we have two values, and we want to write this expression, right?

11
00:00:29,210 --> 00:00:30,440
Four plus five.

12
00:00:31,010 --> 00:00:33,830
So here four and five are called operands.

13
00:00:34,340 --> 00:00:38,450
And the plus sign is called the operator.

14
00:00:40,250 --> 00:00:41,000
So let's continue.

15
00:00:42,690 --> 00:00:48,270
Python is a language, supports some types of operators, and a few of those are.

16
00:00:49,870 --> 00:00:57,970
Arithmetic operators, also known as math operators, comparison operators also known as relational

17
00:00:58,000 --> 00:01:00,910
operators, assignment operators.

18
00:01:02,340 --> 00:01:03,720
Logical operators.

19
00:01:04,770 --> 00:01:08,250
These are the most commonly used operators in Python.

20
00:01:09,360 --> 00:01:12,300
So now let's let's examine all of these one by one.

21
00:01:14,780 --> 00:01:17,540
So we're going to start with arithmetic operators.

22
00:01:18,230 --> 00:01:23,750
So these are actually simple math operators like addition, subtraction, multiplication, division,

23
00:01:24,020 --> 00:01:25,460
exponents, all those.

24
00:01:26,150 --> 00:01:27,860
So let's see them in an example.

25
00:01:29,030 --> 00:01:36,260
If we define two variables named A and B, and the values are nine and 15.

26
00:01:41,270 --> 00:01:44,240
And now we can use math operators one by one.

27
00:01:46,440 --> 00:01:50,010
A plus B, and the result is 24.

28
00:01:50,990 --> 00:01:53,570
B minus a result is six.

29
00:01:55,290 --> 00:01:56,490
A divided by B.

30
00:01:57,240 --> 00:01:59,640
Result is zero point six.

31
00:02:00,210 --> 00:02:06,480
So in this process, we divided the B into the A and Python returns the result.

32
00:02:10,370 --> 00:02:12,250
B, modulo A.

33
00:02:13,100 --> 00:02:14,180
The result is six.

34
00:02:15,170 --> 00:02:20,270
So in this process, we divided B into A and Python returns as the remainder.

35
00:02:20,600 --> 00:02:23,450
This process is called Modulus.

36
00:02:24,140 --> 00:02:25,820
The Exponent two.

37
00:02:28,490 --> 00:02:30,410
The result is 225.

38
00:02:31,070 --> 00:02:34,610
So in this process, we find the second power of 15.

39
00:02:35,030 --> 00:02:38,540
So see, those are the basic math operators in Python.

40
00:02:39,140 --> 00:02:41,570
So now let's continue with comparison operators.

41
00:02:43,080 --> 00:02:49,950
These operators compare the values on either side of them and then decide the relation between them.

42
00:02:50,730 --> 00:02:51,660
But how?

43
00:02:52,820 --> 00:02:53,720
We're going to check it out.

44
00:02:54,080 --> 00:02:58,610
The first we do need to know a little bit about Boolean values in Python.

45
00:03:00,480 --> 00:03:02,430
What are Boolean values?

46
00:03:03,210 --> 00:03:03,540
OK.

47
00:03:03,870 --> 00:03:10,710
There are logical values or more commonly known Boolean values are actually a data type in Python,

48
00:03:10,860 --> 00:03:13,350
and they have two different values.

49
00:03:13,620 --> 00:03:15,390
True and false.

50
00:03:16,320 --> 00:03:16,620
All right.

51
00:03:16,620 --> 00:03:17,610
So how does that work?

52
00:03:18,540 --> 00:03:20,430
Let's look at a couple of examples.

53
00:03:21,380 --> 00:03:25,790
So let's create a variable named AI and let it be true.

54
00:03:30,580 --> 00:03:31,930
And let's look at its type.

55
00:03:32,470 --> 00:03:35,830
So as you can see, the type is class Boole.

56
00:03:36,760 --> 00:03:41,590
Now create another variable named B and let it be false.

57
00:03:46,100 --> 00:03:52,070
So let's look at this one time and also this one's type is Class Boul.

58
00:03:53,390 --> 00:03:57,110
So we will often use these variables when we create a condition.

59
00:03:59,190 --> 00:04:03,840
Now, let's continue with comparison operators and check in on how to use it.

60
00:04:06,320 --> 00:04:09,290
So there are six different comparison operators in Python.

61
00:04:17,250 --> 00:04:18,210
Here's one example.

62
00:04:19,150 --> 00:04:21,760
Let's take our last variables again.

63
00:04:28,400 --> 00:04:30,320
A equals B.

64
00:04:31,010 --> 00:04:32,120
The result is false.

65
00:04:33,750 --> 00:04:40,410
The Eagle operator is checking both values, and if they are equal, then the result would be true.

66
00:04:41,280 --> 00:04:42,540
The result is false.

67
00:04:44,200 --> 00:04:46,630
A, not equal, B.

68
00:04:49,610 --> 00:04:56,610
And the result is true, the not equal operator is checking both values, and if they're not equal,

69
00:04:56,610 --> 00:04:57,740
then the result is true.

70
00:04:58,100 --> 00:05:00,500
Else the result would be false.

71
00:05:02,270 --> 00:05:03,530
A less than B.

72
00:05:09,480 --> 00:05:13,770
The result is true because A is indeed less than B.

73
00:05:15,480 --> 00:05:17,580
A is greater than B.

74
00:05:20,900 --> 00:05:25,100
And the result is false because he is less than B.

75
00:05:26,410 --> 00:05:28,810
A less than equals B.

76
00:05:31,010 --> 00:05:36,780
And the result is true, the less than equal operator is checking both sides.

77
00:05:37,130 --> 00:05:44,180
And if the upper end is less than or equal to the right upper end, then the condition becomes true.

78
00:05:44,360 --> 00:05:46,160
Else, the condition is false.

79
00:05:47,630 --> 00:05:49,640
A greater than equal B.

80
00:05:53,260 --> 00:05:54,400
The result is false.

81
00:05:55,360 --> 00:05:58,750
The greater than equal operator is checking both sides.

82
00:05:59,110 --> 00:06:05,710
If the left operand is greater than or equal to the right operand, then the condition becomes true.

83
00:06:06,070 --> 00:06:07,630
Else the condition is false.

84
00:06:08,530 --> 00:06:11,740
So do you see how the comparison operators work in Python?

85
00:06:12,990 --> 00:06:13,770
Cool.

86
00:06:14,190 --> 00:06:16,290
So let's continue with assignment operators.

87
00:06:18,630 --> 00:06:22,620
Assignment operators are using Python to assign values to variables.

88
00:06:23,280 --> 00:06:30,060
As you may remember, when we define a variable like A equals nine, A is the variable name.

89
00:06:30,390 --> 00:06:34,230
Nine is the variables value and the equals.

90
00:06:34,230 --> 00:06:37,320
Mark is the assignment operator.

91
00:06:38,310 --> 00:06:39,810
And of course, there are many more of them.

92
00:06:40,500 --> 00:06:41,850
I'll give you a few examples.

93
00:06:43,090 --> 00:06:47,170
So we define a variable named S. and its value is one.

94
00:06:48,530 --> 00:06:54,290
So now when we type C plus equals one, the result is two.

95
00:06:56,260 --> 00:07:03,940
Plus, equal mark means that it adds the right operand to the left operand and assigns a result to the

96
00:07:03,940 --> 00:07:04,870
left operand.

97
00:07:06,010 --> 00:07:06,910
Now, what if we type?

98
00:07:07,960 --> 00:07:10,300
C minus equals two.

99
00:07:10,930 --> 00:07:11,950
The result is zero.

100
00:07:13,020 --> 00:07:19,440
The minus equal mark means it adds the right upper end to the left operand and assigns a result to the

101
00:07:19,440 --> 00:07:20,340
left operand.

102
00:07:21,600 --> 00:07:23,100
Now, I think you've already noticed.

103
00:07:23,460 --> 00:07:26,850
We can use these operators with math operators.

104
00:07:26,940 --> 00:07:27,330
Right.

105
00:07:28,080 --> 00:07:34,980
So when we use them with a divide operator and the new key value was assigned the result of the process.

106
00:07:36,210 --> 00:07:39,690
So that's basically the logic of the assignment operators.

107
00:07:40,470 --> 00:07:42,840
Now let's continue with logical operators.

108
00:07:45,460 --> 00:07:48,940
Logical operators are used to combine conditional statements.

109
00:07:49,990 --> 00:07:56,230
So there are three types of logical operators there and or and not.

110
00:07:58,110 --> 00:08:01,020
Now let's look at all three of the operators with a few examples.

111
00:08:02,160 --> 00:08:05,850
So we'll take our A and B variables again and type it.

112
00:08:07,000 --> 00:08:11,140
A equals nine and B equals 15.

113
00:08:19,100 --> 00:08:20,150
And the result is true.

114
00:08:21,300 --> 00:08:22,500
The and operator.

115
00:08:23,420 --> 00:08:28,220
Checks are the result of all the comparison operations is going to be true.

116
00:08:29,550 --> 00:08:33,570
If both the operands are true, then the condition becomes true.

117
00:08:34,580 --> 00:08:37,880
In other cases, the result is false here.

118
00:08:38,480 --> 00:08:42,680
The AAA variable is nine and the B variable is 15.

119
00:08:42,950 --> 00:08:45,120
And as you can see, both situations are true.

120
00:08:45,140 --> 00:08:46,910
So the result is true.

121
00:08:48,750 --> 00:08:53,430
A equals 15 or B equals 15.

122
00:08:59,540 --> 00:09:07,400
And the result is true, the or operator checks to see if at least one of the results of all the comparison

123
00:09:07,400 --> 00:09:08,630
operations is true.

124
00:09:09,590 --> 00:09:18,260
And if any of the two operands are non-zero and then the condition becomes true, in any other case,

125
00:09:18,260 --> 00:09:19,490
the result would be false.

126
00:09:20,980 --> 00:09:26,350
So here the A variable isn't 15, but the big variable is 15.

127
00:09:26,920 --> 00:09:30,640
So one side is true, then the result is true.

128
00:09:33,100 --> 00:09:35,170
Not B equals 15.

129
00:09:37,180 --> 00:09:45,010
So the not operator isn't actually a logical operator, this operator simply converts a logical value

130
00:09:45,010 --> 00:09:47,560
or a comparison to the opposite.

131
00:09:48,310 --> 00:09:56,320
That is, the not operator converts a result that is true to fault and a result that is false to true.

132
00:09:57,190 --> 00:09:59,260
And the big variable is 15.

133
00:09:59,950 --> 00:10:02,200
And as you can see, situations are true.

134
00:10:02,230 --> 00:10:08,740
So the result will become false because it turns true to false.

135
00:10:09,800 --> 00:10:10,320
That's it.

136
00:10:11,130 --> 00:10:16,260
So in this lesson, we learned the operator concept in Python, as well as how to use it.

137
00:10:17,070 --> 00:10:19,710
Also, we examined some of the most common operators.

138
00:10:19,740 --> 00:10:20,610
One by one.

139
00:10:21,840 --> 00:10:27,030
Now, in the next lesson, we're going to learn the conditionals as well as loops in Python.

140
00:10:27,660 --> 00:10:29,100
So I want to see in the next lesson.

141
00:10:29,670 --> 00:10:30,480
Have a nice day.
