Commit 88cd524b by BellCodeEditor

save project

parent d60e5379
Showing with 9 additions and 5 deletions
...@@ -4,12 +4,15 @@ class Hero: ...@@ -4,12 +4,15 @@ class Hero:
self.emv=emv self.emv=emv
self.hp=hp self.hp=hp
self.attack=attack self.attack=attack
def jjj(): def jjj(self):
steve.emv+=1 self.emv+=1
steve.hp+=2 self.hp+=2
steve.attack+=2 self.attack+=2
steve=Hero('史蒂夫',0,20,3) steve=Hero('史蒂夫',0,20,3)
alics=Hero('艾利克斯',0,25,1) alics=Hero('艾利克斯',0,25,1)
jjj() for i in range(5):
steve.jjj()
for i in range(3):
alics.jjj()
print(steve.hp) print(steve.hp)
print(alics.hp) print(alics.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