Commit c64b333a by BellCodeEditor

save project

parent b1ea4a12
Showing with 10 additions and 7 deletions
...@@ -6,11 +6,15 @@ class Human:#Human类 ...@@ -6,11 +6,15 @@ class Human:#Human类
self.attack = attack self.attack = attack
#xiaotong = Human()#创建xiaotong这个人物 #xiaotong = Human()#创建xiaotong这个人物
#print(xiaotong.Hp)#查询血量 #print(xiaotong.Hp)#查询血量
def nanl(): def nanl(self):#升级
xiaotong.attack = xiaotong.attack+5 self.attack = self.attack+5
xiaotong.Hp = xiaotong.Hp+4 self.Hp = self.Hp+4
xiaotong = Human("xiaotong",300,1000) xiaotong = Human("xiaotong",300,1000)
nanl() xiaotong.nanl()#调用
nanl() print(xiaotong.attack,xiaotong.Hp)
print(xiaotong.attack,xiaotong.Hp)
\ No newline at end of file LAN = Human("LAN",10000,0)
LAN.nanl()#调用
print(LAN.attack,LAN.Hp)
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