+ 1

what does this mean

in python wht does this code in bracket mean/ do in loops (i += 1)

12th Jan 2022, 7:27 AM
Semilore
Semilore - avatar
2 Respuestas
+ 5
The operator(+=) is called assignment operator. It's similar to this i = i+1
12th Jan 2022, 7:33 AM
Simba
Simba - avatar
0
Magic Methods & Operator Overloading https://www.sololearn.com/learning/1073/2470/5133/1 class Test(int): def __init__(self, x): self.x = x def __iadd__(self, y): print("__iadd__") return Test(self.x + y) a = Test(4) a += 1 # __iadd__ print(a) # 5
12th Jan 2022, 7:39 AM
FanYu
FanYu - avatar