Commit 578adb5f by BellCodeEditor

save project

parent bef5d471
Showing with 9 additions and 8 deletions
...@@ -5,10 +5,11 @@ class Hero: ...@@ -5,10 +5,11 @@ class Hero:
self.hp=hp self.hp=hp
self.attack=attack self.attack=attack
yase=Hero('yase',300,20) yase=Hero('yase',300,20)
def upgrade(): def upgrade(self):
yase.level=yase.level+1 self.level=self.level+1
yase.hp=yase.hp+50 self.hp=self.hp+50
yase.attack=yase.attack+5 self.attack=self.attack+5
upgrade() houyi=Hero('houyi',300,3000)
upgrade() upgrade(houyi)
print(yase.attack)
\ No newline at end of file print("gjlw:",houyi.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