Commit 60bb9f25 by BellCodeEditor

save project

parent 0d21e6bc
Showing with 14 additions and 16 deletions
class hero: class xue:
def __init__(self,name,hp,attack): def __init__(self,name,banji,xuehao,nianji):
self.level=1 self.nianji=1
self.name=name self.name=name
self.hp=hp self.xuehao=xuehao
self.attack=attack self.banji=banji
def upgrade(self): def upgrade(self):
self.level=self.level+1 self.nianji=self.nianji+1
self.hp=self.hp+10000
self.attack=self.attack+909090
yase=hero('亚瑟',400000,4000) xiaoming=xue('小明',4,25,1)
houyi=hero('后裔',3000,90000000000) xiaogang=xue('小刚',8,34,1)
print('亚瑟的hp'+str(yase.hp)) print('小明的banji'+str(xiaoming.banji))
print('后裔的name'+houyi.name) print('小刚的年级'+str(xiaogang.nianji))
yase.upgrade() xiaogang.upgrade()
print('等级为',houyi.level) print('第二年,小刚年级'+str(xiaogang.nianji))
print('hp为',houyi.hp)
print('attack为',houyi.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