All right.
Let's talk math.
So the nice thing about Python is that right off the bat it has a built in math interpreter.
So what we can use it for his addition subtraction multiplication division etc. We can we can throw
numbers at it and it'll do calculations for us.
So let's take a look at what that actually looks like.
So I'm going to go ahead and get it.
We'll call this math dot pi even call this whatever you'd like.
By the way I'm going to put the ampersand at the end again and we'll just declare our being in Python
three here and then let's just call this math.
So the nice thing about math is we can do a lot of different things.
We're very flexible so for example we can print 50 plus 50.
And here we're just adding right.
So let's take a look at what this looks like.
We go here and we just say Python three math dot pi.
You can see that it prints out 100.
Now we can keep doing this for all sorts of different things.
Right.
We can do 50 minus 50 and we would expect zero here.
Right.
And we can do print 50 times 50
and we can also do print fifty divided by 50 and divide.
So I'm going to give you a chance to catch up here.
I type that very fast.
I also have notes that I'm looking at.
So a little bit of unfair advantage but so when we see these and we save this and we run it we're expecting
everything to interpret just the way it did.
So you see one hundred zero twenty five hundred and then this one point zero which we'll get into in
just a little bit as to why it's coming out in a one point zero format but so we have this here and
we can also do some interesting things like let's do something fun let's do print 50 plus 50 minus 50
times 50 and divide by 50.
And what do you think this is going to do Ah good old friend of pen does if you remember that from math
class.
So try it one more time see a number of pops out pops out of 50 cell.
It also does more complex equations as well.
So there's a few other things that I want to show you in the math section.
And another thing to know I know I've already stressed this before and I'm going to keep stressing it
is to make sure you take good notes.
This is absolutely going to feel overwhelming.
I mean if there are a lot of things that you especially with all the stuff that you're learning take
good notes have a good notebook and make sure you're writing this all down so then you could just go
back and you can reference it.
And from here on out I'm the next video what we're going to do is we're going to make a script and we're
just going to build upon it and I'll just leave everything in that script so that we can have a place
for all of your notes as well.
So here let's talk a couple more things so we can also do exponent.
So let's say we wanted to do fifty to the fiftieth power while we just write it like this.
And now we have exponents here say that run it really quick and we get this very very very large number.
Right.
We could just make this to the second power and make a little bit simpler.
We could also do this.
So we do print and we do 50 percent 6.
Now this is called the modulo.
Let's take a look at what it does
so 50 is not divisible by 6.
Right.
So what it does is it takes the number that is left over.
So we do 50 divisible by six.
OK.
Six goes into it eight times and then it has a leftover number of two.
Right.
Six times eight is forty eight leftover number two.
So that's the modulo What if we were to divide by a number here and we said 50 divided by six.
What is that going to do to us while we print that out and you see it gives eight point three three
three three four.
Perfect.
That's fine.
What if we just want a number without any leftovers.
Well we can do something like this and do 50.
Divided by six and then we'll say no leftovers here OK.
Someone give you a second to catch up will hit save on this and we're gonna go ahead and run it and
you can see that it just gives us this gives us the eight doesn't give us that leftover of two that
we had and put it into fraction form here or decimal form here.
So we have different ways that we can manipulate this numbers and we could do math on the fly.
There's also math modules which we haven't gotten to the modules yet but there are additional math items
that we can pull into this like bringing in random numbers for example and other things that we can
do more advanced calculations in Python but as a base it does quite a bit of items for us and it is
a essentially a built in calculator so we can do quick math on the fly if we need to.
So let's go ahead and from here.
We're going to move on to the next video where we start talking about variables and methods.