0

Can anyone tell me the reason is 2,3,1

https://code.sololearn.com/cJSpAace4Nul/?ref=app

27th Dec 2019, 3:06 AM
Yen Heng Wong
Yen Heng Wong - avatar
2 Antworten
+ 2
a,b,c=1,2,3 a,b,c=c,a,b=b,a,c=c,b,a print(a,b,c) Here, a = 1 b = 2 and c = 3 second line code: a = c b = a c = b then again, c = b a = a b = c At last: b = c # value = 3 a = b # value = 2 c = a # value = 1 print(a, b, c) value is swaped. The last all value is taken so. 2, 3, 1 I also wanna see better explanation, my eng is a bit weak can't explain fully.
27th Dec 2019, 3:28 AM
★«D.Connect_Zone»
★«D.Connect_Zone» - avatar
+ 1
Thx man ★«D.Connect_Zone» so it's chained right
27th Dec 2019, 3:30 AM
Yen Heng Wong
Yen Heng Wong - avatar