#100DaysOfCode in Python Transcripts
Chapter: Days 16-18: List comprehensions and generators
Lecture: Lesson introduction
Login or
purchase this course
to watch this video and the rest of the course contents.
0:00
Welcome back to the 100 days of Python. In the coming three days I will guide you through list comprehensions and generators
0:08
two of my favorite features of the language. We're going to look at how you can make a for loop with an embedded if statement
0:16
more Pythonic by using list comprehensions, then we will load in Harry Potter and use list comprehensions to filter out non valid and stop words.
0:27
Next up, generators. We start very simple with the concept of the yield statement writing a simple generator, we look at the stop iteration exception,
0:38
and how the for loop catches that for you. We move on to more interesting examples and finally compare performance of lists
0:47
and generators, because if your data set grows you definitely want to know about generators. The second day I have practical exercises
0:57
to train your new gained list comprehension and generator skills. The third day I will show you solutions to those
1:05
exercises and I challenge you to take a more advanced generator exercise replicating Unix pipelines and it will be a lot of fun.
1:15
So, lets dive straight into those two Python power tools.