Commit 22eeb7c1 by BellCodeEditor

save project

parent 2ed30f26
Showing with 11 additions and 10 deletions
......@@ -4,13 +4,14 @@ class Hero:
self.name=name
self.hp=hp
self.attack=attack
def upgrade():
aw.level=aw.level+1
aw.hp=aw.hp+50
aw.attack=aw.attack+4
def upgrade(self):
self.level=jg.level+1
self.hp=jg.hp+50
self.attack=jg.attack+4
aw=Hero('aw',300,20)
print('aw',aw.hp)
upgrade()
upgrade()
print('2次后为',aw.hp)
\ No newline at end of file
jg=Hero('jg',240,23)
jg.upgrade()
print('等级',jg.level)
print('血量',jg.hp)
print('攻击',jg.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