Commit efb7b731 by BellCodeEditor

save project

parent ad93c9e7
Showing with 22 additions and 17 deletions
class Hero: # class Hero:
def __init__(self,name,hp,attack): # def __init__(self,name,hp,attack):
self.level = 1 # self.level = 1
self.name = name # self.name = name
self.hp = hp # self.hp = hp
self.attack = attack # self.attack = attack
def upgrade(self): # def upgrade(self):
self.level+=1 # self.level+=1
self.hp+=50 # self.hp+=50
self.attack+=4 # self.attack+=4
yase = Hero("垭瑟",300,20) # yase = Hero("垭瑟",300,20)
houyi = Hero("后羿",250,23) # houyi = Hero("后羿",250,23)
yase.upgrade() # yase.upgrade()
houyi.upgrade() # houyi.upgrade()
print(yase.level) # print(yase.level)
print(yase.attack) # print(yase.attack)
print(houyi.hp) # print(houyi.hp)
for i in range(1,10):
for j in range(1,i+1):
print(str(i)+'*'+str(j)+str(i*j),end=' \n')
\ 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