Commit 60bb9f25 by BellCodeEditor

save project

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