summaryrefslogtreecommitdiff
path: root/progs/a47.py
blob: 94c3374b6cc5289a3f8f683a583bec0e1e250346 (plain)
1
2
3
4
from itertools import zip_longest, chain, tee
def exchange_elements(lst):
    lst1, lst2 = tee(iter(lst), 2)
    return list(chain.from_iterable(zip_longest(lst[1::2], lst[::2])))