Let's break down the code:
x = 5
y = 2
x *= -y
print(x, y)
Here's what happens step by step:
x is initially assigned the value 5.
y is initially assigned the value 2.
x *= -y is equivalent to x = x * -y, which means multiplying the current value of x by -y and assigning the result back to x.
Therefore, x becomes 5 * -2, resulting in x being updated to -10.
The print(x, y) statement prints the current values of x and y.
So, the output of this code will be:
-10 2
0 Comments:
Post a Comment