This video covers complete detail on Python lists. It starts with the information on how to create a list using square bracket notation as well as list function. Then, I explain about indexing elements of a list. Further, I talk about list slicing operation which are succinct method to get substring from the original string in Python. We can also use negative indices in Python lists.
I cover topics of Data Science, Machine Learning, Java programming and Data Engineering in my channel. If you like it, consider subscribing
Towards the later part of the video, I teach about how we can iterate through a list and how we can make use of the enumerate function to get index along with the actual element from the list. I also explain about the unpacking operation in Python lists.
I also walk through many of the important built-in methods to work with list datatypes. We learn about how we can insert an element and remove an element from a list. Also, we may need to search for an item in a list. For that, we can use the index method or we could also use Python "in" operator. I also explain a function sorted and a method to sort elements of a list in ascending or descending orders.
Finally, I give few practical examples of list comprehension. List comprehension provides elegant solution to writing loops, but this should be used only in simple cases. If we use it in complicated cases, it may reduce the readability of the code. We can also include guards in list comprehension to filter elements based on if expression.
Top comments (0)