diff --git a/diy.py b/diy.py index dadce7e..ef9c07b 100644 --- a/diy.py +++ b/diy.py @@ -4,11 +4,13 @@ class Hero: self.hp=hp self.attack=attack self.name=name + def a(self): + self.level=self.level+1 + self.hp=self.hp+50 + self.attack=self.attack+20 -def a(self): - self.level=self.level+1 - self.hp=self.hp+50 - self.attack=self.attack+20 - -hy=hy1 -print(hy1.hp) \ No newline at end of file +ys=Hero('ys',300,20) +hy=Hero('hy',240,30) +ys.a() +hy.a() +print(ys.hp) \ No newline at end of file