enumerate iterable solution in Clear category for Swap Nodes by Phil15
def swap_nodes(iterable): # works with any iterable, not just lists.
i = 1 # in case of an empty iterable, i doesn't exit without that.
for i, elem in enumerate(iterable):
previous = elem
if not i%2:
Jan. 22, 2019