0
What is the *= in python
l
3 odpowiedzi
+ 5
k *= 5 is the same as k = k * 5
+ 1
It's a shortcut equivalent of:
x *= n (same as x = x * n)
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