Python Lists for Data Science | List Slicing, Methods | List Comprehension

preview_player
Показать описание
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.

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.

How to create list in Python [0:49]
Indexing Elements of a List [4:10]
List Slicing in Python [6:55]
Unpacking lists in Python [10:14]
Iterating List Elements [11:03]
Useful List Methods (adding, removing an element) [13:18]
Finding an Element in a Python List [22:17]
List Sorting [24:23]
List Comprehension in Python [27:32]

If you like our content, click on *SUBSCRIBE* button and click on Bell icon to receive latest and greatest updates of my video lessons.

Follow us on Facebook, Twitter, Instagram

Рекомендации по теме