Swapping variable values

Want to learn more? I recommend these Python books: Python for Data Analysis, Python Data Science Handbook, and Introduction to Machine Learning with Python.

Setup the originally variables and their values

one = 1
two = 2

View the original variables

'one =', one, 'two =', two
('one =', 1, 'two =', 2)

Swap the values

one, two = two, one

View the swapped values, notice how the values for each variable have changed

'one =', one, 'two =', two
('one =', 2, 'two =', 1)