how to switch 2 values in python code example Example: swapping variables in python a = 1 b = 2 a, b = b, a # a = 2 , b = 1