Commit ec14a003 by BellCodeEditor

auto save

parent 09375f76
Showing with 50 additions and 0 deletions
class Hero:
def __init__(self,name):
self.name=name
self.level=1
self.hp=250
self.attack=40
def gongji(self,dueifang):
y1=self.name+'对'+dueifang.name+'发起攻击,'
y2='造成'+str(self.attack)+'点伤害,'
dueifang.hp-=self.attack
if dueifang.hp>0:
y3=dueifang.name+'还剩'+dueifang.hp+'点血'
print(y1+y2+y3)
else:
y3=dueifang.name+'已阵亡'
print(y1+y2+y3)
exit()
class player(Hero):
def __init__(self,name,yingxiongleixin):
super.__init__(name):
self.hp=200
self.attack=50
self.yingxiongleixin=yingxiongleixin
print(self.name+'已创建'+self.yingxiongleixin)
print(self.name+'的等级,血量,攻击分别是'+str(self.level),str(self.hp),str(self.attack))
player=player('后羿','射手')
\ No newline at end of file
class Box:
def __init__(self,chang,kuan,gao):
self.chang=lenghth1
self.kuan=width1
self.gao=height1
def volume(self):
return self.changI*self.kuan*self.gao
print()
\ No newline at end of file
class studen:
def __init__(self,name,age,city,money):
self.name=name
self.city=city
self.money=money
self.age=age
def one(self,lesson):
print(self.name+'学员正在学习'+lesson+'课程')
def two(self):
print(self.name+'期望薪资为'+self.money)
w=studen('sb',15,'yu',999)
w.one('vcgydevc')
\ 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