Commit 830f6136 by BellCodeEditor

save project

parent 3c1f898a
Showing with 17 additions and 7 deletions
class Hero: class Hero:
def __init__(self): def __init__(self,name,hp,attack):
self.level=999 self.level=999
self.hp=825 self.name=name
self.attack=500 self.hp=hp
wyh=Hero() self.attack=attack
print("wyh的血量为:",wyh.hp) def upgrade(self):
print("wyh的攻击力为:",wyh.attack) wyh.level+=1
\ No newline at end of file wyh.hp+=50
wyh.attack+=4
wyh=Hero('wyh',500,80)
wyh.upgrade()
print("wyh的血量为",wyh.hp)
print("wyh的血量为",wyh.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