Commit 2e3eb90d by BellCodeEditor

save project

parent d6c81a0f
Showing with 17 additions and 0 deletions
class Hero:
def __init__(self,name,hp,attack,level):
self.level=level
self.name=name
self.hp=hp
self.attack=attack
def shengji(self):
self.hp=self.hp+50
self.attack=self.attack+5
self.level=self.level+1
yase=Hero("亚瑟",300,20,1)
dijia=Hero("迪迦",200,30,1)
yase.shengji()
print(yase.name+str(yase.hp))
print(dijia.name+str(dijia.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