Commit ad9f3029 by BellCodeEditor

save project

parent 6717ad24
Showing with 10 additions and 20 deletions
class Hero: alist = [88,75, 72, 82, 90, 85, 78, 91]
def __init__(self, name, hp, attack): n=len(alist)
self.level = 1 for j in range(n-1):
self.name = name # name:名字 for j in range(n-1):
self.hp= hp if alist[j]>alist[j+1]:
self.attack= attack # attack:攻击 t=alist[j]
def upgrade(self): alist[j]=alist[j+1]
self.level+=1 alist[j+1]=t
self.hp+=50
self.attack+=4
houyi=Hero("后羿",250,25)
houyi.upgrade()
print("等级为:",houyi.level)
print("血量为:",houyi.hp)
print("攻击力为:",houyi.attack)
\ No newline at end of file
alist =
der_init_(self): \ No newline at end of file
self.name="亚瑟"
class Hero():
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