Commit 069e687e by BellCodeEditor

save project

parent 73620470
Showing with 10 additions and 4 deletions
...@@ -6,6 +6,12 @@ class Hero: ...@@ -6,6 +6,12 @@ class Hero:
self.attack=attack self.attack=attack
yase=Hero('亚瑟',30,300) yase=Hero('亚瑟',30,300)
houyi=Hero('后羿',25,350) def upgrate():
print(yase.name+'血量为:'+str(yase.hp)) yase.level+=1
print(houyi.name+'血量为:'+str(houyi.hp)) yase.hp+=50
\ No newline at end of file yase.attack+=5
print(yase.name+'的攻击力是:'+str(yase.attack))
upgrate()
print('升级之后'+yase.name+'的攻击力是:'+str(yase.attack))
upgrate()
print('升级之后'+yase.name+'的攻击力是:'+str(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