Commit 3cad7bac by BellCodeEditor

save project

parent 2e2fe83e
Showing with 12 additions and 8 deletions
......@@ -4,14 +4,17 @@ class Hero():
self.name=name
self.hp=hp
self.attack=attack
yase=Hero("垭瑟",300,20)
def upgrade(self):
self.level=self.level+1
self.hp=self.hp+50
self.attack=self.attack+4
houyi=Hero("后羿",250,23)
print(yase.level,yase.name,yase.hp,yase.attack)
print(houyi.level,houyi.name,houyi.hp,houyi.attack)
def upgrade():
self.level=self.level+1
self.hp=self.hp+50
self.attack=self.attack+4
print(houyi.level,houyi.name,houyi.hp,houyi.attack)
upgrade()
yase=Hero("垭瑟",300,20)
yase.upgrade()
print(yase.level,yase.name,yase.hp,yase.attack)
\ 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