Commit 082aa89a by BellCodeEditor

save project

parent a096ef1d
Showing with 9 additions and 6 deletions
class Hero:
def __init__(self):
def __init__(self,name,HP,attack):
self.level=1
self.HP=300
self.attack=30
luban=Hero()
print(luban.HP)
\ No newline at end of file
self.name=name
self.HP=HP
self.attack=attack
luban=Hero('鲁班',300,30)
kai=Hero('凯',500,25)
print('鲁班的血量是',luban.HP)
print('凯的攻击是',kai.attack)
\ 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