Commit 80ca61fc by BellCodeEditor

save project

parent 1993aafb
Showing with 10 additions and 6 deletions
......@@ -4,14 +4,17 @@ class Hero():
self.hp=hp
self.attack=attack
self.name=name
def upgrade(name):
name.level=name.level+1
name.hp=name.hp+50
name.attack=name.attack+4
yase=Hero('亚瑟',300,30)
houyi=Hero('后羿',250,23)
def upgrade():
yase.level=yase.level+1
yase.hp=yase.hp+50
yase.attack=yase.attack+4
upgrade()
upgrade()
yase.upgrade()
houyi.upgrade()
print(yase.hp)
print(yase.attack)
print(yase.level)
print(houyi.hp)
print(houyi.attack)
print(houyi.level)
\ 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