Commit b6e98d16 by BellCodeEditor

save project

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