fork download
  1. # your code goes here
  2.  
  3. class X:
  4. def __init__(self, n):
  5. self.x = n
  6. def __add__(self, n):
  7. self.x = self.x + n
  8. def __repr__(self):
  9. return str(self.x)
  10.  
  11. def add_one(a):
  12. a = a + 1
  13.  
  14. x = X(10)
  15. add_one(x)
  16.  
  17. print(x)
Success #stdin #stdout 0.01s 7736KB
stdin
Standard input is empty
stdout
11