Find the output of following code: x =2 y =3 x +=y print(x,y)
Answers
Answered by
18
Answer:
5 3
Explanation:
x = 2
y = 3
x +=y #x = 2 + 3 = 5
print(x,y)
output:
5 3
Answered by
2
The output of the code is ( 5, 3 ).
Given: A code is given.
To Find: Output of the code.
Solution:
The given code is,
x = 2, y = 3;
x += y;
We are required to find the output of the above code snippet.
The line x += y means,
x = x + y where, x = 2 and y = 3
So, the output will be
x = 2 + 3
= 5
The value of x gets changed to 5 while the value of y stays as 3
Hence, print(x,y) will show (5,3) as output.
Thus, the output of the code is ( 5, 3 ).
#SPJ3
Similar questions