To switch the value of two variables you can use tuple unpacking.
x = True y = False x, y = y, x x # False y # True