0

Can someone explain me the solution of this question?

x,y=20,60 y,x,y=x,y-10,x+10 print(x,y)

14th May 2020, 5:28 AM
Uditya Kumar
Uditya Kumar - avatar
3 Antworten
+ 1
im not sure but i think its preloading the variables, and so it goes this way: x=20 y=60 y=(preloaded x) 20 x =(preloaded y) 60-10 y =(preloaded x) 20 + 10
14th May 2020, 5:51 PM
Sascha Bujnow
Sascha Bujnow - avatar
0
Why it is taking preloaded values of x and y . As the value changed in the second line . So in memory also the value should change?
14th May 2020, 5:54 PM
Uditya Kumar
Uditya Kumar - avatar
0
a, b, *c, d = [1, 2, 3, 4, 5, 6, 7, 8, 9] print(a) print(b) print(c) print(d) As you can see here, it needs to be preloaded so it nows how many numbers are left for c* And I think that's the same as in your code, as soon as a code line is started its preloading everything Sorry don't know how to describe it better xD
15th May 2020, 9:02 AM
Sascha Bujnow
Sascha Bujnow - avatar