In this article you will learn about itertools.pairwise, how to use it, and how to generalise it.
Feel like exercising your brain? Have a go at one of the problems I have for you.