Commit 0b029a58 by BellCodeEditor

save project

parent 71b4628a
Showing with 18 additions and 11 deletions
class aaaaa:
def __init__(self,n,h,a):
self.l=1
self.n=n
self.h=h
self.a=a
aa=aaaaa('亚瑟',300,20)
b=aaaaa('后羿',250,23)
print(aa.n,aa.h,aa.a)
print(b.n,b.h,b.a)
class Hero():
def __init__(self,name,hp,attack):
self.level=1
self.name=name
self.hp=hp
self.attack=attack
def upgrade(self):
self.level=self.level+1
self.hp=self.hp+50
self.attack=self.attack+4
ys=Hero('亚瑟',300,20)
hy=Hero('后羿',300,20)
ys.upgrade()
hy.upgrade()
print(ys.level,ys.hp,ys.attack)
print(hy.level,hy.hp,hy.attack)
\ 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