A utility in eClinicalWorks may need to exchange two in-memory values, such as a current appointment status and a previous status, without allocating a third variable. Implement a function that returns the two values in reversed order while using constant auxiliary space.
Write swap_values(a, b), where a and b are integers. Return a two-element tuple (b, a). You must not use a third variable, list, dictionary, or other container to hold the values during the swap. The original arguments are immutable from the caller's perspective, so the returned tuple represents the exchanged result.
You may use Python tuple unpacking in the primary solution. Also consider how an arithmetic or XOR-based approach behaves with negative values and equal inputs.
a and b are integers.-10^9 <= a, b <= 10^9.(b, a).def swap_values(a, b):