Commit 73620470 by BellCodeEditor

save project

parent fe67196a
Showing with 9 additions and 8 deletions
class Hero: class Hero:
def __init__(self): def __init__(self,name,hp,attack):
self.level=1 self.level=1
self.hp=200 self.name=name
self.attack=35 self.hp=hp
self.attack=attack
yase=Hero() yase=Hero('亚瑟',30,300)
print('亚瑟的等级是:'+str(yase.level)) houyi=Hero('后羿',25,350)
print('亚瑟的血量是:'+str(yase.hp)) print(yase.name+'血量为:'+str(yase.hp))
print('亚瑟的攻击力是:'+str(yase.attack)) print(houyi.name+'血量为:'+str(houyi.hp))
\ No newline at end of file \ 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