groupby(), islice() and starmap()

Let's figure out the iterators that do not terminate. i.e. groupby(), islice() and starmap().

groupby(iterable, key=None)

The groupby iterator will return consecutive keys and groups from your iterable. This one is kind of hard to wrap our heads around without seeing an example. So let’s take a look at one!

Get hands-on with 1200+ tech skills courses.