Commit 5206efd7 by BellCodeEditor

save project

parent 43a6804b
Showing with 11 additions and 7 deletions
...@@ -4,12 +4,15 @@ class Hero: ...@@ -4,12 +4,15 @@ class Hero:
a.name=name a.name=name
a.hp=hp a.hp=hp
a.attack=attack a.attack=attack
def ab(a):
a.level=a.level+1
a.hp=a.hp+50
a.attack=a.attack+4
yasa=Hero("垭瑟",300,20) yasa=Hero("垭瑟",300,20)
houyi=Hero("后羿",250,23) houyi=Hero("后羿",250,23)
yasa.ab()
def ab(): houyi.ab()
yasa.level=yasa.level+1 print(houyi.hp)
yasa.hp=yasa.hp+50 print(yasa.hp)
yasa.attack=yasa.attack+4 \ No newline at end of file
ab()
print(yasa.hp)
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