fork download
  1. # your code goes here
  2. class Personnage:
  3.  
  4. static_property = 0
  5.  
  6. def __init__(self,name,last):
  7.  
  8. self.name = name
  9. self.last = last
  10. Personnage.static_property += 1
  11.  
  12. @property
  13. def name(self):
  14. return self.__name
  15.  
  16. @name.setter
  17. def name(self,name):
  18. self.__name = name
  19.  
  20. @property
  21. def last(self):
  22. return self.__last
  23.  
  24. @last.setter
  25. def last(self,last):
  26. self.__last = last
  27.  
  28. @staticmethod
  29. def times():
  30. return "it called {} times".format(Personnage.static_property)
  31.  
  32. def __str__(self):
  33. return "Hello from {} Class Your Username is {} and Your Lastname is {}".format(self.name,self.last)
  34.  
  35. class Child(Personnage):
  36.  
  37. def __init__(self,name,last,town,ager):
  38.  
  39. Personnage.__init__(self,name,last)
  40. self.town = town
  41. self.ager = ager
  42.  
  43.  
  44. @property
  45. def town(self):
  46. return self.__town
  47.  
  48. @town.setter
  49. def town(self,town):
  50. self.__town = town
  51.  
  52. @property
  53. def ager(self):
  54. return self.__ager
  55.  
  56. @ager.setter
  57. def ager(self,ager):
  58. self.__ager = ager
  59.  
  60. def __str__(self):
  61. super.__str__() + " and You're Living in {} and You are {} years old".format(self.town,self.ager)
  62.  
  63. def main():
  64.  
  65. person = Personnage("elomari","mohammed")
  66. print(person)
  67.  
  68. main()
Runtime error #stdin #stdout #stderr 0.04s 9356KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
Traceback (most recent call last):
  File "./prog.py", line 68, in <module>
  File "./prog.py", line 66, in main
  File "./prog.py", line 33, in __str__
IndexError: tuple index out of range