You can add a new element at any position in your list by using the insert insert method.
You do this by specifying the index of the new element and the value of the new item.
In this case, we will make the auxiliary courses that insert here.
First, we will enter the index.
In this case, let's actually add two zero the first index here, and after that we will enter the value.
In this case, let's actually make the let's add new course, the courses list.
And in this case, we will add the computer forensics course and that's it.
So now we will print the auxiliary courses.
And here, as you can see here, under coding training in 33 hours specified and course in the world.
And lastly, we will have here.
Oops.
Combative ranks.
Now, of course, we want to this year, the first year we added the first index with this zero here.
So in this example, we insert a value computer forensics course at the beginning of the list.
So the insert method opens a space position at the zero and stores the value computer forensics course
at here.
So, for example, let's make sure here we.
Oops, let's actually use the boxes.
So one, two, three, four.
We have four boxes, right?
Three.
So here.
If you write like that, it will add the our new value to here and.
Our index Android here is going to be one now from now on here.
Our index Android is going to be one, two, three, four and the newly added.
Computer forensics course is going to be what?
Yes.
Zero.
And as you can see here, this this course is splitted like this, this increase it by one because of
the we added here.
So this operations shifts every other value in the list one position to the right here.
So we can also remove elements from a list.
So actually let's try another example now here one right.
Let's try this now.
And here now we will create the same illustration here.
In this case, for example, one, two.
Three.
All right.
So here we add a new element here.
Right?
So now, from now on, our new element will be added at the here, right?
This in the first index.
So now our element is added here.
Of.
Our element is added here.
Actually.
Instead, we use the blue for the newly added elements and we we didn't touch.
The first element.
So index zero.
And here this index here in this case, Android Kotlin training is going to stay the same, Right?
It will not move or trigger anything.
So it will stay the same.
It will stay the same.
But here we added to this is the new value.
But all of this here three.
Three, four, five.
So here, before insertion, this was two and this was three and this was four.
And there was no computer forensics course in here.
Let's now remove the elements from the list.
So often you will want to remove an item or set a set a set of items from a list.
So, for example, when a player shoots down an alien from the sky, you will most likely want to remove
it from the list of active aliens.
So when a user decides to cancel their account on a web application you created, you will want to remove
that user from the list of active users so you can remove an item according to its position in the list
according to its value.
So if you know the position of the item you want to remove from a list, you can use the Del statement.
So how are we going to do that?
Is now we add it here.
Let's actually leave it here.
Let's actually delete it so the new programmers will not confuse anything with it.
So this is our list, right?
And instead of doing this, let's add to the end.
One, two, three, four.
So zero, one, two, three, four here.
And let's run here.
And as you can see here, it added at the end.
As you can see here, that's it.
So now.
I will also comment that this this is.
This code inserts item to list into, list into list.
And here we will remove an item from it.
So now I want to hear drive again something here which is.
So this is.
One.
We're sorry.
One, two.
Right?
Right.
So here, according to this this element, the computer forensics course goes to here, MySQL goes to
here.
And this poster here.
All right.
Let's actually illustrate it so you will make.
You will understand better.
Yeah, that's it.
So the index of these values are, as you remember, zero.
Oops.
Sorry.
Index of these values are zero.
One, two.
Three and four.
That's it.
So now after that, we will remove that item from the list.
In this case, let's remove the base python.
Let's remove the ethical hacking with python into 20 hours, which is the index for.
Let's actually make it tick on them here.
So here.
We will remove this now, Right?
So Del here.
Oxer the courses and you enter the ID here.
In this you enter the.
Position here.
And in this case, it's two and that's it.
Now, we will print the courses here.
And as you can see here, we have Android coding training here.
Check.
Best python course in the world.
Check.
Designing database models with.
MySQL check.
And computer forensics course.
And as you can see here, we do not have ethical hacking anymore.
So according to this, now the tree has become.
To index.
Index has become index two and index four become index three, and we no longer have index four here.
So this index gone and also it splitted here.
So the design of MySQL here got goes here and computer forensics here goes here.
And in this list we do not have the index four anymore, but we deleted.
Ethical hacking from the index two.
This is how the list works.
So in this case let's actually try what will index four give us here?
Or actually, yes, let's actually instead of this, let's print the value.
So.
Print the value.
Oxer the courses and print the value for all four.
And here, as you can see here.
List index out of range.
This is the reason that gave us because there is no anymore fourth index here.
So actually, instead of this we here, let's actually undelete this.
And yes, perfect.
Perfect.
That's it.
Now let's remove the another item from the position here.
And now let's remove Del Oxley courses.
Let's actually remove the item zero.
And now.
Actually, we don't need that code anymore.
And that's it.
As you can see here, we have left with three items in the list.
So.
That's it.