Commit 456e628e by BellCodeEditor

auto save

parent d7a79fca
Showing with 17 additions and 6 deletions
class hero: class hero:
def __init__(self): def __init__(self,name,hp,attack):
self.level = 1 self.level = 1
self.hp = 200 self.name = name
self.attack = 25 self.hp = hp
self.attack = attack
def upgrade(self):
self.level += 1
self.hp += 50
self.attack += 5
yase = hero("亚瑟",300,20)
houyi = hero("后羿",240,23)
yase.upgrade()
houyi.upgrade()
print(yase.attack)
print(houyi.attack)
yase = hero()
print(yase.hp)
\ 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