Commit 3fcdd0bf by BellCodeEditor

save project

parent 137085e7
Showing with 9 additions and 5 deletions
...@@ -4,8 +4,12 @@ class Hero(): ...@@ -4,8 +4,12 @@ class Hero():
self.name=name self.name=name
self.hp=hp self.hp=hp
self.attack=attack self.attack=attack
def up():
luban.level=luban.level+1
luban.hp=luban.hp+50
luban.attack=luban.attack+4
luban=Hero("鲁班",300,20) luban=Hero("鲁班",300,20)
guanyu=Hero("关羽",250,23) print("鲁班的初始血量为:",luban.hp)
print("鲁班的血量为:",luban.hp) up()
print("关羽的血量为:",guanyu.hp) up()
def upgr print("升级后血量为:",yase.hp)
\ No newline at end of file \ 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