Commit 578adb5f by BellCodeEditor

save project

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