Your question is Swap Variables Without Temp. Start with the requirements on the right.
Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.
A CGI configuration utility receives two integer settings that must be exchanged before processing continues. Implement a function that swaps the values without declaring or using a temporary variable.
Write swap_values(a, b), where a and b are integers. Return a two-element list containing the values in swapped order: [b, a]. The input variables themselves do not need to be modified outside the function.
Use Python's assignment semantics or another valid algorithmic technique. Do not create a named temporary variable to hold either value.
def swap_values(a, b):