A

Admin • 833.24K Points
Coach

Q. What is the output of the following code?

Code:
x = 10
y = 5
x, y = y, x
print(x, y)
  • (A) 10 5
  • (B) 5 10
  • (C) 10 10
  • (D) 5 5
  • Correct Answer - Option(B)
  • Views: 31
  • Filed under category Python
  • Hashtags:

Explanation by: Admin

Values of `x` and `y` are swapped using tuple unpacking.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.

Be the first to start discuss.