Commit 6c55c424 by BellCodeEditor

save project

parent 05c0b9d3
Showing with 10 additions and 5 deletions
...@@ -4,10 +4,10 @@ class Hero: ...@@ -4,10 +4,10 @@ class Hero:
self.name=name self.name=name
self.hp=hp self.hp=hp
self.attack=attack self.attack=attack
def upsj(): def upsj(name):
self.level+=1 name.level=self.level+1
self.hp+=20 name.hp+=20
self.attack+=2 name.attack=self.attack+2
yase=Hero('yase',300,20) yase=Hero('yase',300,20)
hy=Hero('hy',250,23) hy=Hero('hy',250,23)
k=Hero('K',5600,199) k=Hero('K',5600,199)
...@@ -18,4 +18,9 @@ print(hy.attack) ...@@ -18,4 +18,9 @@ print(hy.attack)
print(k.attack) print(k.attack)
print(y.attack) print(y.attack)
print(dc.attack) print(dc.attack)
Hero.upsj() def upsj(name):
name.level=name.level+1
name.hp+=20
name.attack=name.attack+2
upsj(y)
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