Commit 72a16c0b by BellCodeEditor

save project

parent 63071d48
Showing with 9 additions and 3 deletions
...@@ -4,6 +4,12 @@ class Hero: ...@@ -4,6 +4,12 @@ class Hero:
self.atk=atk self.atk=atk
self.name=name self.name=name
self.level=1 self.level=1
def levelup(self):
self.hp=self.hp+1
self.atk=self.atk+1
self.level=self.level+1
yase=Hero("yase",10,10) houyi=Hero("yase",100,10)
print(yase.name)
\ No newline at end of file houyi.levelup()
print(houyi.hp)
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment