
Swap Nodes
Your task is to swap elements of the list (Iterable) pairwise. If you are given a list of 4 elements, then your function should return the same list, only in it the first and second elements are interchanged, as well as the third and fourth.
If there isn’t a paired amount of elements, then leave the last unpaired element in its place. An empty list should remain empty.
Input: Iterable.
Output: Iterable.
Example:
swap_nodes([1, 2, 3, 4]) == [2, 1, 4, 3] swap_nodes([5, 5, 5, 5]) == [5, 5, 5, 5]