Commit ededd85d by BellCodeEditor

save project

parent b83ec5f2
Showing with 10 additions and 4 deletions
class Hero: class hero():
def __init__(self,name,hp,attack): def __init__(self,name,hp,attack):
self.level=1 self.level=1
self.hp=hp self.hp=hp
self.attack=attack self.attack=attack
self.name=name self.name=name
rao=Hero("rao",0.1,0.1) def upgrade(self):
print(rao.hp,rao.attack) self.level=self.level+1
rao.level=rao.level+1 self.hp=self.hp+100
self.attack=self.attack+70
rao=hero("a",100,240)
houyi=hero("b",90,200)
rao.upgrade()
print(rao.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