You may assign several variables at once by unpacking a list or tuple:
a, b = 0, 1 # a gets 0 and b gets 1 a, b = [0, 1] # exactly the same effect (a, b) = 0, 1 # same [a,b] = [0,1] # same thing
Use packing and unpacking to swap the contents of two variables:
a, b = b, a