0

What is the *= in python

l

4th Nov 2017, 6:14 AM
Dhruv
3 Réponses
+ 5
k *= 5 is the same as k = k * 5
4th Nov 2017, 6:18 AM
johan beimers
johan beimers - avatar
+ 1
It's a shortcut equivalent of: x *= n (same as x = x * n)
4th Nov 2017, 6:29 AM
Boris Batinkov
Boris Batinkov - avatar
0
They are shorthand: a += b // a += 7 is the same as a = a + b // a = a + 7 Etc... so a -= b is equivalent to a = a - b a *= b is equivalent to a = a * b a /= b is equivalent to a = a / b
4th Nov 2017, 6:19 AM
Cool Codin
Cool Codin - avatar