QuestionQ57

VerifiedComputer Programming and Python Fundamentals

What output is expected from the following code?

Question Image

Explanation

Python evaluates the right-hand side of a multiple assignment before assigning the resulting values to the targets. Thus z, y, x = x, y, z reverses x and z, resulting in x = 1, y = 2, and z = 3; print(x, y, z) outputs 1 2 3.

Community Discussion

No comments yet. Be the first to start the discussion!