What is the output of ty following program? Are the values same in both print statements ?
X = 10
print (x)
x = x + 10
x= x - 5
X, y = x + 5, 10
print (x)
Answers
Answered by
1
Answer:
X = 10
X = X + 10
X = X - 5
print (X)
X, Y = X - 2, 22
print (X, Y)
Answered by
0
X = 10 ⇒ assigns an initial value of 10 to X.
X = X + 10 ⇒ X = 10 + 10 = 20. So value of X is now 20.
X = X - 5 ⇒ X = 20 - 5 = 15. X is now 15.
print (X) ⇒ print the value of X which is 15.
X, Y = X - 2, 22 ⇒ X, Y = 13, 22.
print (X, Y) ⇒ prints the value of X which is 13 and Y which is 22.
No the values are not same ☺️
Hope it helps ❤️
Similar questions