Question #311

What is the output of the code snippet below?
a = 1
b = 2
b, a = a, b
print(b)

An application of unpacking in Python is swapping values between variables without using a temporary or auxiliary variable. In this case, b receives the value of a e.g. 1 . (stackabuse.com/unpacking-in-python-beyond-parallel-assign...)


Comment on Disqus:

Question difficulty: ๐Ÿ”ต๐Ÿ”ต๐Ÿ”ต๐Ÿ”ต๐Ÿ”ต


Similar questions: