Hey Everyone, I am Vikram Salunke and welcome to Python for InfoSec.
This is a part 4 and in this post we will see Operators.
Let's first look at the numbers.
In Python integers and floats can be represented. Let's look at the integer example
num1 = 2
ok, this is an integer.
And what is float? float is any number with decimal.
num2 = 4.2
ok, this is a float.
Let's look at the operators, first we are going to see assignment operator.
Assignment operator assigns the values of right side operand to the left side operand.
num1 = 2
This is assignment operator.
2 has assigned to num1, so, num1 contains 2.
This is known as assignment operator, which we have seen earlier.
Now let's look at the Arithmetic Operators.
Addition, Subtraction, Multiplication, Division, Modules, Exponent etc. are known as the Arithmetic Operators.
Now let's first look at the, Addition Operator
num1 = 2 + 2
Let's look at the num1
Ok, so addition operator add the values and store the result into the variable.
In this case 2 got added into 2 and it got stored into num1.
Let's look at the subtraction operator
num2 = 4 - 2
So, it subtracts the value from right side operand from left side operand and store the result into the variable.
Now let's look at the multiplication operator.
num3 = 4 * 2
It multiplies the value and store the result into the variable.
Let's look at the division operator
num4 = 4 / 2
It divides the left hand hand operand with right side operand.
Let's look the Modules operator
num5 = 8 % 2
It stores the remainder by dividing left side operand with right side operand.
Now let's look at the Exponent Operator
num6 = 2 ** 2
So it calculates the exponential power.
There are other operators also such as Relational, Logical, Bitwise Identity, Membership etc. I am not going to confuse you guys with too much information. So, we will see those operators when we will need them
If you want to join our in person class then please click here
we are doing trainings in some upcoming InfoSec conferences.
And if you have any doubts, any questions then you can tweet me @vikramsalunke20
We are uploading daily new videos on YouTube click here to subscribe.
If you want to solve the exercises on this topic those are below. Solve the exercises and check your understandings. Thank you :)