+ 1

How to swap 2 numbers using python?

Need clear explanation about the code.

11th Oct 2018, 5:09 PM
Shehan Lahiru Jayasinghe
Shehan Lahiru Jayasinghe - avatar
14 ответов
+ 5
a, b = b, a
11th Oct 2018, 5:15 PM
Anna
Anna - avatar
+ 2
And where's the explanation? :'D Python' s so friendly to us, you only learn to truly appreciate it after you try something else...
11th Oct 2018, 5:26 PM
HonFu
HonFu - avatar
+ 1
It is standard Python behavior. You can exchange values of more than two variables in any order. Why not to play with the following code? a = 1 b = 2 c = 3 a, b, c = c, a, b print (a,b,c)
11th Oct 2018, 8:07 PM
Микола Федосєєв
Микола Федосєєв - avatar
+ 1
yer sure.That is possible
19th Oct 2018, 4:18 PM
Shehan Lahiru Jayasinghe
Shehan Lahiru Jayasinghe - avatar
+ 1
Lavanya G Can you stop spamming please?
19th Oct 2018, 4:18 PM
Anna
Anna - avatar
0
hiii🙋 shehan will u teach me jdbc
19th Oct 2018, 4:07 PM
Lavanya G
Lavanya G - avatar
0
I'm lavanya
19th Oct 2018, 4:08 PM
Lavanya G
Lavanya G - avatar
0
what is the meaning of jbdc.I didn't get it lavanya
19th Oct 2018, 4:13 PM
Shehan Lahiru Jayasinghe
Shehan Lahiru Jayasinghe - avatar
0
java database
19th Oct 2018, 4:17 PM
Lavanya G
Lavanya G - avatar
0
could u contact me privately
19th Oct 2018, 4:17 PM
Lavanya G
Lavanya G - avatar
0
ssry
19th Oct 2018, 4:17 PM
Lavanya G
Lavanya G - avatar
0
its
19th Oct 2018, 4:17 PM
Lavanya G
Lavanya G - avatar
0
jdbc
19th Oct 2018, 4:18 PM
Lavanya G
Lavanya G - avatar
0
what??
19th Oct 2018, 4:19 PM
Lavanya G
Lavanya G - avatar