What will be the output of the following code x,y=2,6 x,y=y,x+2print ( x,y)
Answers
Answered by
33
Answer:
x,y=2,6
x,y=y,x+2
print ( x,y )
python output for this is 6 4
Answered by
2
Given that,
x , y = 2 , 6
x , y = y , x + 2
Initially, 2 and 6 are the assigned values to x and y respectively.
A new condition is defined where in; x = y and y = x + 2.
The code would look like :
>>> x,y = 2,6
>>> x,y = y,x + 2
>>> print(x,y)
6 4
The output would be 6 and 4 respectively.
#SPJ3
(Refer the attachment for the code)
Attachments:
Similar questions