Hey everybody and welcome to the next video.
So in this video we're going to talk about something called operators.
Now this is gonna be pretty important when you're wanting to make small incremental changes to different
types of variables or tribe to form some sort of mathematic operations.
Now there are a few options that you have with with operators so you've got your standard plus minus
multiplication and division.
Now there are a few others such as the modules which we won't be going over in this course we're gonna
be going over just some of the basic ones that you're going to need.
Now these work the same as they do in real life.
So you're adding things together subtracting things multiplying dividing.
The process is the same.
So if we have a temp set to five actually going to do that we'll do equal to five plus five and we'll
just print temp
if I can spell perfect.
So again this is just going to provide us are 10.
Right.
Nice and clean.
Same thing for subtraction.
We are going to get our
zero multiplication.
Same process get our twenty five and then division we get our one.
Perfect.
Now those are the basic operators.
Now those are gonna be pretty standard through most languages that you're going to see.
Just keep an eye on if some of them happen to use be used in slightly different way.
But the core component that I want you to understand is not this particular way of going about it.
Now this is pretty common as I said aware that it's there.
You will use this.
But what I want to go over is a special type of operators.
Now let's say we set temp to 10.
Right.
So Tempus time.
Now maybe what if we want to add one to temp so we could do temp is equal to temp plus one.
Right.
We could do that and that's completely valid.
And it will work.
We get our lesson right.
However that can be pretty cumbersome to read later.
So what you can do is you can put the operator before the equal sign.
So plus equals one.
So this is going to take.
This is essentially equivalent to this you're just combining this part and just putting a plus in the
front.
Now if we see we get the same we will get the same outcome here.
So we get 11.
Perfect.
Now we can do the same thing for subtraction but a minus and find the plus we get our 9.
Same thing for division the asterisk there and get our 10 and we do divide
changes to two let's say.
Right.
Make the change a little bit more apparent.
All right.
Perfect so that's what I want you guys to understand is that you can do different types of operations
on data.
So it's not just you know not just floats as an example.
So plus equals you know 2.5.
Right so you can see it casted already.
The the answer twelve point five in the temp as a float it takes float as as the priority because there's
a point five.
Now you can cast the different ways like we can do you know 10 divided by one point five as an example
so you can you can mix and match it in different ways depending on what objects you have you can do
unique things.
So that's how operators work in Python specifically.
There are a few languages where adding you know plus one would just be adding plus plus to the end.
However that's not the way to do it in Python.
So you might be used to doing it that way if you're already you already know some other languages like
Java.
However in this particular case it's a plus equals.
And then whatever amount of data you want so we can do whatever amount of data we want so that's been
operators in this particular video.