Commit 5f80d817 by BellCodeEditor

save project

parent c4edfe09
Showing with 12 additions and 6 deletions
...@@ -5,12 +5,17 @@ class Hero: #类 ...@@ -5,12 +5,17 @@ class Hero: #类
self.leve=1 self.leve=1
self.attack=attack self.attack=attack
def upgrade(): def upgrade(self):
www.leve+=1 self.leve+=1
www.hp+=50 self.hp+=50
www.attack+=5 self.attack+=5
www=Hero("sdeg",300,20) www=Hero("sdeg",300,20)
upgrade() www.upgrade()
upgrade() www.upgrade()
print(www.hp) print(www.hp)
qqq=Hero("刘艺航",100000,999999)
qqq.upgrade()
qqq.upgrade()
print(qqq.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