Commit c171ca8a by BellCodeEditor

save project

parent f47689a4
Showing with 16 additions and 0 deletions
class Hero:
def __init__(self,name,Hp,attack,level):
self.Hp=Hp
self.level=level
self.attack=attack
def upgrade(self):
self.level=self.level+1
self.attack=self.attack+500
self.Hp=self.Hp+1000
yalian=Hero('亚连',3468,299 ,1)
print(yalian.Hp)
yalian.upgrade()
yalian.upgrade()
print(yalian.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