Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
1-liner: zip it solution in Clear category for Swap Nodes by przemyslaw.daniel
swap_nodes = lambda data: list(sum(zip(data[1::2], data[::2]), ()))+data[-1:]*(len(data) % 2)
Jan. 22, 2019