Pairs interchange

Write the function interchange() that takes a string, and returns another string obtained by interchanging the positions of each non-overlapping consecutive pair of characters. Save this function into the file interchange.py. Examples:

>>> interchange('Today')
'oTady'
>>> interchange('Tomorrow')
'oTomrrwo'
>>> interchange('123456789')
'214365879'
>>> interchange('1234567890')
'2143658709'
>>> interchange('Houston, we have a problem.')
'oHsuot,nw  eaheva p orlbme.'
>>> interchange('A')
'A'

Note

More tests are provided in file interchange.txt

Solution

A solution is provided in file interchange.py