Commit db6faa9b by BellCodeEditor

save project

parent bfc5a3f2
Showing with 9 additions and 7 deletions
class hero: class hero:
def __init__(self): def __init__(self,name,hp,attack):
self.level=1 self.level=1
self.hp=300 self.name = name
self.attack= 20 self.hp= hp
yase = Hero() self.attack= attack
print("yase的血量值为:",yase.hp) yase = hero("垭瑟",500,2000)
print("yase的攻击力为:",yase.attack) sunwukong = hero("孙悟空",1000,2000)
\ No newline at end of file print("垭瑟的血量值为:",yase.hp)
print("孙悟空的攻击力为:",sunwukong.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