fork download
  1. # your code goes here
  2.  
  3. class MyInt:
  4. def __init__(self, v):
  5. self._v = v
  6.  
  7. def __iadd__(self, other):
  8. self._v += other._v
  9. return self
  10.  
  11. def __repr__(self):
  12. return str(self._v)
  13.  
  14.  
  15. def func(arg):
  16. arg += MyInt(10)
  17. print("Done!")
  18.  
  19. x = MyInt(100)
  20. func(x)
  21. print(x)
Success #stdin #stdout 0.02s 27712KB
stdin
Standard input is empty
stdout
Done!
110