Commit b0f282a3 by BellCodeEditor

auto save

parent 86661135
Showing with 7 additions and 17 deletions
class Hero: list1= [1,2,3,4,5,6]
def __init__(self,name,hp,attack): list1.append(100)
self.level=1 list1.insert(1,1000)
self.name=name list1.pop(2)
self.hp=hp list1[3]=20
self.attack=attack print(list1[3:6])
\ No newline at end of file
def asd(self):
self.level=self.level+1
self.hp=self.hp+50
self.attack=self.attack+4
yase=Hero("亚瑟",300,20)
yase.asd()
yase.asd()
print("等级是"+str(yase.level))
print("血量是"+str(yase.hp))
print("攻击力是"+str(yase.attack))
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