Commit 0b029a58 by BellCodeEditor

save project

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