+ 7

This make python great.

Why Python Is Great: # In-place value swapping # Let's say we want to swap # the values of a and b... a = 23 b = 42 # The "classic" way to do it # with a temporary variable: tmp = a a = b b = tmp # Python also lets us # use this short-hand: a, b = b, a

7th Mar 2018, 1:24 PM
Maninder $ingh
Maninder $ingh - avatar
3 odpowiedzi
+ 13
What if syntactic sugar isn't my thing? :P
7th Mar 2018, 1:34 PM
Hatsy Rei
Hatsy Rei - avatar
+ 10
that's ok too @Hasty Rei ;)
7th Mar 2018, 2:12 PM
cyber33
cyber33 - avatar
+ 9
You can do the same in ruby 😎 a = 2; b = 3 a, b = b, a
7th Mar 2018, 1:28 PM
Lord Krishna
Lord Krishna - avatar