Commit 0fa64b1d by BellCodeEditor

save project

parent 967e7521
Showing with 10 additions and 9 deletions
...@@ -5,18 +5,19 @@ class Hero: ...@@ -5,18 +5,19 @@ class Hero:
self.hp=hp self.hp=hp
self.attack=attack self.attack=attack
def qwe(): def qwe(self):
yese.level=yese.level+1 self.level=self.level+1
yese.hp=yese.hp+50 self.hp=self.hp+50
yese.attack=yese.attack+10 self.attack=self.attack+10
yese=Hero('亚瑟',100,10) yese=Hero('亚瑟',100,10)
hoyi=Hero('后羿',200,20)
qwe() hoyi.qwe()
qwe() hoyi.qwe()
qwe() hoyi.qwe()
qwe() hoyi.qwe()
qwe() hoyi.qwe()
print('他的名字:',yese.name) print('他的名字:',yese.name)
print('亚瑟的等级:',yese.level) print('亚瑟的等级:',yese.level)
......
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