Commit 535b816c by BellCodeEditor

save project

parent 0eef1899
Showing with 10 additions and 4 deletions
class hero: class hero:
def __init__(self): def __init__(self,name,hp,attack):
self.level=1 self.level=1
self.mane=mane self.name=name
self.hp=hp self.hp=hp
self.attack=attack self.attack=attack
def urgrade_yase():
yase.level=yase.level+1
yase.hp=yase.hp+1
yase.attack=yase.attack+1
yase=hero("亚瑟",300,20) yase=hero("亚瑟",300,20)
houyi=hero("后羿",250,23) houyi=hero("后羿",250,23)
print("亚瑟的血量是",yase.hp) print("亚瑟的血量是",yase.hp)
print("后羿的血量是",houyi.hp) urgrade_yase()
\ No newline at end of file urgrade_yase()
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