[no audio]
Friends, here we are
going to discuss about Python operators.
So the concepts are like you know, what is an operator and
what are the different types of operators present in your
Python scripting, right?
Let me start that.
See basically operators are the pillars for any language, not
only your python, okay, for any language operators are the pillars.
So without operators you cannot write effective logic while
writing your code. Right. Fine.
Then, what is an operator?
See the operator can be defined as a symbol which is responsible
for a particular operation between two operands.
Let me take simply two variables called 'x=2', and
'y=3'. Now
I need to find out the addition of these two variables,
then I am going to take some other variable
'result=x + y'.
[no audio]
Now here simply '+' is your operator,
[no audio]
and you are performing this
addition on your two variables called 'x' and 'y'. Now in this
expression if '+' is the operator, then 'x' and 'y' are called
operands. Right. Of course '=' is also one of the operand.
What we are doing with the help of '=' means, whatever the
'result' you are getting, that 'result'
we are assigning to this variable.
So here addition is the action, here assignment is the action.
[no audio]
Right. So simply guys, operator is just simply your symbol like '+',
'-', 'x'.
We have some different symbols as well and we will see them.
And there is an action with respect to your each and every
symbol. So as of now we are using '+'. '+' we know it is
used to add two values.
Now those two values may be variables
or sometimes directly you can substitute your values,
let's say 3 + 2
also I can do it, or I can store 'x' into some variable called
'x=3', and I can perform 'x+2', or I can store even
2 also into some variable then I can find 'x+y'. Right.
Now if you observe your operator, this is your operator,
as of now you are, I mean in this expression you are directly
performing your operation on two values, but here one is
variable and one is value, but here both are values. That
means while performing your operation with the help of your operator,
right, operands maybe values, or maybe variables, or combination
of your values and variables.
Right. So for simple example, you can take '+' is an operator
to perform addition operation on your operands, right. Fine.
Now Python provides a variety of operators like you know,
arithmetic operators, assignment operators, comparison operators,
identity operators, membership operators, and then logical
operators, and finally we have bitwise operators.
So these are the seven operators in your Python Scripting
language. So before going to write your logic first of
all you should be very, very good with your operators.
[no audio]
Right. And one more thing guys, before going to start each
and every operators, right, here
I am going to give you one idea. If you are able to remember
that, as of now you can remember that.
[no audio]
That is like, see first two operators like arithmetic operators
and assignment operators, for these two you are going to provide
input as a value,
and whatever the operators are there in your arithmetic and
assignment they will do their action on your input,
then it'll provide output also as a value.
[no audio]
Right. Then coming to next three operators, like comparison,
identity, membership operators.
So here we are going to provide input as a value.
But these operators will perform some action on your inputs,
and they will provide output as either 'True' or 'False'.
See guys, for your first of two operators you are providing
input as a value and you are getting output also value, but
for next three operators you are providing input as your
values and output you're going to get either 'True' or 'False',
means you are getting Boolean values.
Right. Then coming to logical operators, for this logical operators
you are providing input as 'True' or 'False' and also output you're
getting either 'True' or 'False'.
[no audio]
Then the last one is bitwise operators. See in bitwise operators
you are going to provide input as a value and also you're
getting output also value.
I mean both inputs and outputs are values, but while performing
the operation on your given values by your bitwise
your data will be converted into bits or binary, and on that
binary data logical operations will be performed. Then finally
you're going to get your result as a value.
So guys for time being if you are able to remember, just remember
this structure so that it will be helpful while working with
your operators.
Right. So simply remember that first inputs need, first two operators
input is a value and output also a value. Then for next three
operators input is some value but output you're also getting
some value but that is purely a Boolean data, that is 'True'
or 'False'. Then for logical operators input is Boolean output
is also Boolean data. Now for last one, bitwise operators input
and output both are values, but while performing the operation
by your bitwise operators on your given values, right,
so directly they don't do. What it will do is, your data will
be converted as a binary, and on that binary the logical operation
will be performed on your inputs,
okay. So this will be helpful if you are able to remember.
You just try to remember this.
Okay guys, thank you for watching this video.
[no audio]