diy2.py 317 Bytes Edit 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 class Hero: def __init__(self,name,hp,attack): self.level = 1 self.name = name self.hp = hp self.attack = attack yase = Hero("亚瑟",280,26) houyi = Hero("后羿",310,32) def up(): yase.level += 1 yase.hp += 50 yase.attack += 4 up() up() print(yase.hp)