Commit b6e98d16 by BellCodeEditor

save project

parent fdb363a1
Showing with 23 additions and 18 deletions
class Hero: class dog:
def __init__(self,name,level,hp,attack): def __init__(self,color):
self.name=name self.leg=4
self.level=level self.eye=2
self.hp=hp self.ear=2
self.attack=attack self.color=color
def upgrade(self): a=dog('red')
self.level=self.level+1 print(a.color)
self.hp=self.hp+50 #self.attack=attack
self.attack=self.attack+4 # def upgrade(self):
yase=Hero('亚瑟',1,300,20) # self.level=self.level+1
heyi=Hero("后裔",1,250,23) # self.hp=self.hp+50
print('亚瑟的血量为',yase.hp) # self.attack=self.attack+4
yase.upgrade() # yase=dog('亚瑟',1,300,20)
heyi.upgrade() # heyi=Hero("后裔",1,250,23)
# print('亚瑟的血量为',yase.hp)
# yase.upgrade()
# heyi.upgrade()
print('亚瑟的血量为',yase.hp) # print('亚瑟的血量为',yase.hp)
print('后裔的攻击力为',heyi.attack) # print('后裔的攻击力为',heyi.attack)
\ No newline at end of file \ No newline at end of file
print("hello world")
\ 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