Recently I encountered the following multiple assignment, and have no idea how it swaps two nodes. I want to swap two nodes in a linked list. The code is :
head, head.next = head.next, head
as seen on https://leetcode.com/problems/swap-nodes-in-pairs/discuss/171788/Python-or-Dummynode
Can someone break down the steps and tell me how that code swaps head and head.next? It's very confusing to me.