Commit bf8dd185 by BellCodeEditor

auto save

parent 84c3821d
Showing with 15 additions and 8 deletions
class Hero: class Hero:
def __init__(self,name,hp,attack): def __init__(self,name,hp,attack):
self.Name=name self.Name=name
self.Hp=hp self.Level=1
self.Attack=attack self.Hp=hp
HIM=Hero('亚瑟',100,50) self.Attack=attack
DA=Hero('韩团',10,100) def up(self,n):
print(HIM.Hp) self.Level+=n
print(DA.Hp) self.Hp+=50
\ No newline at end of file self.Attack+=4
H=Hero('亚瑟',100,50)
D=Hero('韩团',10,100)
print(H.Hp)
print(D.Hp)
H.up(1)
print(H.Level,H.Hp,H.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