#100DaysOfCode in Python Transcripts
Chapter: Days 16-18: List comprehensions and generators
Lecture: Second day: a practical exercise
Login or
purchase this course
to watch this video and the rest of the course contents.
0:01
Welcome back to 100 Days of Python.
0:03
The second day of list comprehensions and generators.
0:06
Now that we've got some theory down,
0:08
it's all about getting practice.
0:10
I've got some small exercises to get practice.
0:14
So, here you're provided with a names list
0:18
of names and surnames.
0:19
And can you write a simple list comprehension
0:22
to convert those names to title case, and reverse the
0:25
first and the last name?
0:27
Then we use that data to make a simple
0:30
generator that generates output like this.
0:35
So, we initialize the generator.
0:37
We look through a range of 10,
0:40
and call next on the generator.
0:42
And every time we call next
0:44
it returns name one teams up with name two.
0:47
And those names are randomly chosen
0:50
That should not be too hard
0:52
after yesterday's lesson.
0:54
So have fun, and tomorrow
0:55
we'll show you the solution to
0:56
these two exercises.