Commit e318d357 by BellCodeEditor

save project

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