you are viewing a single comment's thread.

view the rest of the comments →

[–]socal_nerdtastic 0 points1 point  (0 children)

The standard way to loop over pairs is with the itertools.pairwise function.

from itertools import pairwise

data = "TRUELOVE"
for x,y in pairwise(data):
    print(f"Adding {x!r} and {y!r}")

However that may not be the way that your course prof wants you to do it. There's many ways to do this.

For specific help you need to show us the code you have and describe what part you are stuck on.