Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Initial variable declaration
- a = 1
- b = 2
- # printing out values before swap
- print("Before the swap, the value of a is", a, "and the value of b is", b)
- # Variable swap construct. This assigns the value of b to a and the value of a to b.
- a, b = b, a
- # printing out values after swap
- print("After the swap, the value of a is", a, "and the value of b is", b)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement