Commit 0522451b by BellCodeEditor

save project

parent 0e18de62
Showing with 18 additions and 7 deletions
class Hero: class Hero:
desc ="这是个角色" desc ="煲仔饭的属性:"
def __init__(self): def __init__(self,name,hp,level,attack):
self.level=1000 self.name=name
self.hp=9999999 self.level=level
self.gongjili=999 self.hp=hp
gaozesheng=Hero() self.attack=attack
gaozesheng=Hero("煲仔饭",99999,1000,999)
print(Hero.desc) print(Hero.desc)
print(gaozesheng.hp) print("角色的名字",gaozesheng.name)
print("煲仔饭的血量",gaozesheng.hp)
print("煲仔饭的等级",gaozesheng.level)
print("煲仔饭的攻击力",gaozesheng.attack)
mengziyun=Hero("鳗鱼饭",89537,1000,1023)
print(Hero.desc)
print("角色的名字",mengziyun.name)
print("鳗鱼饭的血量",mengziyun.hp)
print("鳗鱼饭的等级",mengziyun.level)
print("鳗鱼饭的攻击力",mengziyun.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