X = X + Y # Now X holds the sum of X and Y
Y = X - Y # Subtract Y from the sum, so Y becomes the original X
X = X - Y # Subtract the new Y (original X) from the sum, so X becomes the original Y
X = -5
Y = 2
print(f"X = {X}, Y = {Y}")
X = X + Y # Now X holds the sum of X and Y
Y = X - Y # Subtract Y from the sum, so Y becomes the original X
X = X - Y # Subtract the new Y (original X) from the sum, so X becomes the original Y
print(f"X = {X}, Y = {Y}")
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.