In-place operators allow you to write code like ‘x = x + 3’ more concisely, as ‘x += 3’.
The same thing is possible with other operators such as -, *, / and % as well.
>> x = 2
>>> x += 3
These operators can be used on types other than numbers, as well, such as strings.
>> x = “spam”
>>> x += “eggs”
CLICK ON THE BUTTON BELOW TO GO TO THE PYTHON MAIN COURSE PAGE.
©️ License: All Rights Reserved
CONTACT HOLLA TECH – LEARN SUPPORT