Commit ba0d793c by BellCodeEditor

save project

parent e2998b3b
Showing with 6 additions and 6 deletions
...@@ -4,14 +4,14 @@ class Hero: ...@@ -4,14 +4,14 @@ class Hero:
self.name=name self.name=name
self.hp=hp self.hp=hp
self.attack=attack self.attack=attack
def upgrade(self): def upgrade(self):
self.level=Huaqiang.level+1 self.level=self.level+1
self.hp*=11 self.hp*=11
self.attack*=11 self.attack*=11
#Zhangsan=Hero('张三',9999999,9999) Zhangsan=Hero('张三',9999999,9999)
#upgrade() Zhangsan.upgrade()
Huaqiang=Hero('华强',9999999,9999) Huaqiang=Hero('华强',9999999,9999)
upgrade(self) Huaqiang.upgrade()
print('华强的hp为:9999999'+str(Huaqiang.hp)) print('华强的hp为:9999999'+str(Huaqiang.hp))
#print('张三的hp为:9999999'+str(Zhangsan.hp)) print('张三的hp为:9999999'+str(Zhangsan.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