Commit e318d357 by BellCodeEditor

save project

parent 67158192
Showing with 11 additions and 6 deletions
class Hero():
def __init__(self):
def __init__(self,name,hp,attack):
self.level = 1
self.hp = 500
self.attack = 100
sb=Hero()
print(sb.hp)
\ No newline at end of file
self.name=name
self.hp = hp
self.attack = attack
sb=Hero("孙悟空",1000,100)
bigsb=Hero("韩信",1000,99)
biggersb=Hero("李白",999,100)
print("孙悟空的血量为:",sb.hp)
print("韩信的血量为:",bigsb.hp)
print("李白的血量为:",biggersb.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