Question #61

What is another way of writing this code?
a = a + 1

a += b is essentially the same as a = a + b , except that: + always returns a newly allocated object, but += should (but doesn't have to) modify the object in-place if it's mutable (e.g. list or dict, but int and str are immutable); In a = a + b ,a is evaluated twice. (stackoverflow.com/questions/823561/what-does-mean-in-pyth...)


Comment on Disqus:

Question difficulty: šŸ”µšŸ”µšŸ”µšŸ”µšŸ”µ