Commit b239c43d by BellCodeEditor

auto save

parent 22354288
Showing with 34 additions and 0 deletions
class Hero:
def __init__(self,name,hp,attack):
self.level=1
self.name=name
self.hp=hp
self.attack=attack
def up_grude(self):
self.leyel=self.level+1
self.hp=self.hp+100
self.attack=self.attack+5
yase=Hero('yase',300,200)
for i in range(5):
yase.up_grude()
print(yayase.attack)
\ No newline at end of file
class Hero:
def __init__(self,name,hp,attack):
self.level=1
self.name=name
self.hp=hp
self.attack=attack
yase=Hero('yase',300,20)
hy=Hero('hy',250,23)
cga=Hero('cga',5600,199)
# print("亚瑟的属性为",yase.hp,yase.attack)
# print("后裔的属性为",hy.hp,hy.attack)
# print("国奥的属性为",cga.hp,cga.attack)
def upgrade():
hy.attack=hy.attack+4
hy.hp=hy.hp+50
upgrade()
upgrade()
print("后裔的属性为",hy.hp,hy.attack)
\ 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