Commit b1ea4a12 by BellCodeEditor

save project

parent d6c81a0f
Showing with 17 additions and 0 deletions
class Human:#Human类
def __init__(self,name,Hp,attack):#self是必须的
self.leavl = 1
self.name = name
self.Hp = Hp
self.attack = attack
#xiaotong = Human()#创建xiaotong这个人物
#print(xiaotong.Hp)#查询血量
def nanl():
xiaotong.attack = xiaotong.attack+5
xiaotong.Hp = xiaotong.Hp+4
xiaotong = Human("xiaotong",300,1000)
nanl()
nanl()
print(xiaotong.attack,xiaotong.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