Welcome back to our class of our course about the complete introduction to that science with Python.
So basically this class, we are going to talk about plenty of very interesting formulas that you guys
will see are really, really interesting and simple to use.
So basically, the four well, the five operations that we are going to learn to do today are pretty
simple.
The first one would allow us to create an area.
So it's going to be the Lenn space operation that will allow us to create Arrowood with numbers that
will be automatically generated.
The same one will be slicing.
So basically, we are going to slice our area into what we will be able to slice our area, for example,
with multiple areas, with multiple lines into an area, with just one line with the numbers that we
want.
And finally, we're going to talk about the min max and some functions which are also really simple
to use and can be really effective.
So let's start.
So I said the first function that we are going to talk about, the little space function, basically
how this function works is pretty simple.
So the first thing.
So why is it used?
At first it's used to create a ARRY with numbers that are from an equal distance from one another.
So how exactly this works so pretty simple.
We want to generate or we want to create a variable.
So the one in this case equal, so empty like always that in this case the function would be in space.
From this moment.
We want the first number that we going to enter here because we have three elements inside of this variable.
The first one would be the first number.
So let's say we want to have 10 as our first number, then that's our start number.
So our saying no would be, let's say, 50.
So basically what we are asking right now, Python to do is starting with the number 10 and finishing
at the number 50.
And we want Python to generate how many random numbers at equal distance, how many numbers of equal
distance, let's say one python to generate one hundred numbers at equal distance between 10 and 50.
Let's start with less than one hundred.
Let's say we want to generate only two numbers.
So what we will see right here, just printing that function print.
He was.
So we will see is that Python judgment written and if we ask Python to generate four numbers.
So in this case, it will generate 10 as first number, then twenty three to three feet, then 36,
then 50.
So those numbers are at equal distance.
So basically they're at equal distance from ten to twenty three.
The trajectory is at equal distance.
That twenty three from thirty six, that's sixty six from fifty.
Those can see it's pretty simple.
We can do this with really huge numbers.
For example, one hundred is just going to take more time to complete.
But as you can see, you can have really huge numbers and it's going to automatically calculate everything.
So as you can see, this function could be really, really interesting for bigger projects and for the
same function that we are going to talk about would be the slicing function.
And for this function, we would we would need to create ourselves an area.
So like always, we will create ourselves and airy and pretty simple.
So we want to start that with a variable.
So once again, we will have are one and that area.
And from this moment, we'll create an area that will be two two dimensional because this function works
with two dimensional areas.
So pretty simple.
We will have our even then numbers as always.
So two, four and six and four decision area we will have in this case one, three and five.
So you can see it's pretty simple.
So we have one, three and five.
So we have our area right here.
So just to try out will print it.
Print we are one.
Here we go.
So if we run it, as you can see, it works.
So everything is fine.
So what I want to do right now is work with so we want to slice our function.
So basically, how exactly will slice our function?
It's pretty simple.
So let's say we only want the number four.
So how exactly we'll do this?
It's pretty simple.
We'll write down print and what exactly what we want.
We want to print from variable one.
So from variable one, we want to print inside of the line zero.
So this line, the line zero, we want the first argument.
So basically in Python, we start counting from zero.
So this would be zero.
This would be one.
This would be two.
So from the line zero, this would be our line zero.
We want to print the element number one or number two.
So basically how we'll write it down right here.
So from the line zero, we want to print the element number two.
So No.
One in this case, because in Python language is going to be one.
And if we run it, we will have four.
So as you can see, it's pretty simple to understand.
Now, let's say, for example, we want to print the number four and the number three right here.
So basically for the two areas.
So how exactly do we write it down?
It's pretty simple.
We will use the two points.
So what does those two points mean?
So from the line zero until the infinity of all lines.
So basically until the end, I want to print all the number ones.
So if I translate basically from the line zero from here to the end, if I hear I only have two lines
basically from here till the end, I want to print out number one.
So basically it's going to print the four and the three right here.
So if I run, the app will do it will print for entry as well.
So for the purpose of this example, will add more areas.
So just to try it out inside of those areas will just write down some random numbers.
For example, seven.
Twenty four.
Twenty one.
Then.
30 and 50.
All right.
And if we want our app, it's going to do the exact same thing.
As I said, it's going to print all the number ones in all the areas.
All right.
So you guys get the point.
Now, let's say we want to print from here from the from this line right here.
So pretty simple.
Instead of writing zero right here, what we'll do is we'll ask Python to print from line number, let's
say one.
So from this line right here until the end, we want to print out number one.
So from line number one, want to print all, number one.
So it's going to print the three to twenty four and the 30.
So if we run the app, as I said, it printed the three, the twenty four and the third.
So this is the slicing part.
So you guys get the point and you understand why exactly do we use slicing.
All right.
So next few functions that we are going to talk about.
You'll see they're pretty simple to use and they are work the exact same way.
So those are the men, the max and the sum function as well.
So, as always, what we need right now, we need are so basically we'll just create a variable.
So in this case, the one that will be equal to our area.
So like always in that area, you open up the parenthesis and in this case, like always going to be
two, four, six.
All right.
So we get our area right here.
Next thing that we want to do is just finding out the max of all this.
So basically print.
The first thing we write down are are a variable name, so in this variable, so in our one, we want
to print the max so that Max open and close parenthesis really important and run the app.
And as you can see, it will print us six.
So we have our six right here.
So this is the max of this area.
What's cool about it is that it works for all types of well for one dimension as well as two dimensional
arrays.
So if we add a second dimension to this area, so two we have two, four, six.
And let's say we add one, three and five.
Like we always do and we were on the up, as you can see, it's going to stay six, but here we have
50, for example.
You'll see it's going to become 50.
So basically it's going to work with the whole area right here.
All right.
So same thing for the men.
If one of the men of all this pretty simple instead of Max just right down the middle and you guys can
run the up and it's going to be one.
So the men, the smallest number is one.
And if we change one bit, then the smallest number will become two.
So in this case, it's going to be two.
All right.
And finally, the last thing is this.
So basically what the sum function where the sum operation will do inside of this area will simply calculate
the sum of all the numbers inside of this.
So very simple.
Just write down some very important print.
So the name of our of our Bible, Dutson, you run the app and as you can see it, give us twenty one.
So basically is the sum of all the numbers right here.
So as you can see, it's pretty simple to understand those are some other really simple functions that
works with errors and numbers.
So those are really simple of applications.
So I hope you guys learned some few things inside of this class.
And in the next class, we are still going to learn some other numbers by operations.
So that's it for this class, guys, and see all in our next class.