`itertools.pairwise` takes an iterable and produces overlapping pairs of consecutive elements: ```py from itertools import pairwise queue = ["John", "Joe", "Ana"] for f, b in pairwise(queue): print(f"{f}'s ahead of {b}.") # John's ahead of Joe. # Joe's ahead of Ana. ```
1 likes 1 replies
?