Commit 71603ad8 by BellCodeEditor

save project

parent c8a33791
Showing with 21 additions and 6 deletions
......@@ -10,8 +10,23 @@ k=Hero('K',5600,199)
print(yase.attack)
print(hy.attack)
print(k.attack)
def apgrade()
hy.level+=1
hy.hp+=50
hy.attack+=4
\ No newline at end of file
class Hero:
def __init__(self):
self.hp=500
self.level=1
self.attack=50
zhuoxing=Hero()
print("zhuoxing的血量值为:",zhuoxing.hp)
print("zhuoxing的攻击力为:",zhuoxing.attack)
print("zhuoxing的等级为:",zhuoxing.level)
yase=Hero("亚瑟",300,20)
print("亚瑟的初始血量是:",yase.hp)
upgrade()
upgrade()
print("升级两次后,亚瑟的血量值为:",yase .hp)
\ 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