Commit be60caf4 by BellCodeEditor

auto save

parent 4fc1c908
Showing with 11 additions and 6 deletions
......@@ -4,15 +4,20 @@ class Hero:
self.name=name
self.hp=hp
self.attack=attack
def upgrade(self):
self.hp+=60
self.level+=1
self.attack+=666
yase=Hero('yase',300,20)
hy=Hero('hy',250,23)
k=Hero('K',5600,199)
def upgrade():
yase.hp+=60
yase.level+=1
yase.attack+=666
for i in range(2):
upgrade()
print("升级两次后,yase的血量为"yase.hp)
yase.upgrade()
hy.upgrade()
k.upgrade()
print("yase的等级",yase.level," 血量",yase.hp," 攻击",yase.attack)
print("hy的等级",hy.level," 血量",hy.hp," 攻击",hy.attack)
print("k的等级",k.level," 血量",k.hp," 攻击",k.attack)
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