Subscribe to the channel http://bit.ly/30OgRJZ if you find these videos helpful for you I will keep making more of them.
Lists are mutable data structures in Python or changeable, ordered sequence of elements.
.
As you can see from the video there are many ways that we can take elements from a list and also add and remove elements.
.
I will go through the most important ones that I can think of.
.
There are two ways to add elements or items to the list based on this example we use append and insert functions.
.
The append function will add the item directly at the end of the list.
.
While the insert function takes two arguments the position that you want to insert the item at and the value of that item.
.
So if you want to put your item in a specific location in the list make sure to use the insert function.
.
Similarly, we have two functions to remove an item from a list.
.
You only need to give the value of the item that you want to remove to the remove function.
.
The pop function will remove by default the last item in the list, it will also save that item in a variable if you want to.
.
For example.
.
Popped = P_languages.pop()
Popped = 'Ruby' .
.
Next time we will be talking more about lists and show you even more functions that you can work with.
share with me some of the other functions that you can use with lists and what do you think of this. Comment below 👇.
.
I'm also active on other social media platforms so you can find me on the links below, don't hesitate to ask me anything.
.
.
Instagram : / jubara_abdallah
LinkedIn : / abdalla-ashraf
Twitter : / abdallah_jubara
Github : https://github.com/abdallahash
Portfolio : https://abdallahash.github.io
.
#listsinpython #learnpython #pythonforbeginners #learntocode