Commit a18e0903 by BellCodeEditor

save project

parent bb3c69f4
Showing with 11 additions and 6 deletions
class Hero: class Hero:
def __init__(self,hp,attack): def __init__(self,name,hp,attack):
self.level = 1 self.level = 1
self.name = name
self.hp = hp self.hp = hp
self.attack = attack self.attack = attack
yase = Hero(300,20) yase = Hero("垭瑟",300,20)
houyi = Hero(270,23)
print("垭瑟的血量为:",yase.hp) print("垭瑟的血量为:",yase.hp)
print("垭瑟的攻击力为:",yase.attack) print("垭瑟的攻击力为:",yase.attack)
print("后羿的血量为:",houyi.hp)
print("后羿的攻击力为:",houyi.attack) def upd():
\ No newline at end of file yase.hp+=50
yase.attack+=4
upd()
upd()
print("升级2次后,垭瑟的血量为:",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