Suppose you have two variables a and b.

a = 80

b = 50

a,b = b,a

Now your b value will be 80 and a value will be 50.

This is so simple in python to swap between two elements.

 

Leave a Reply

Your email address will not be published. Required fields are marked *