Commit 2f6bfcec by BellCodeEditor

auto save

parent b0e82751
Showing with 16 additions and 4 deletions
...@@ -4,8 +4,14 @@ class Hero: ...@@ -4,8 +4,14 @@ class Hero:
self.name = name self.name = name
self.hp = hp self.hp = hp
self.attack = attack self.attack = attack
def up(self):
self.level = self.level + 1
self.hp = self.hp + 50
self.attack = self.attack + 4
yase = Hero("亚瑟",300,20) yase = Hero("亚瑟",300,20)
houyi = Hero("后羿",240,23) houyi = Hero("后羿",240,23)
print(yase.name) yase.up()
print(houyi.name)
\ No newline at end of file print(yase.hp,yase.attack)
houyi.up()
print(houyi.hp,houyi.attack)
\ No newline at end of file
sum = 0
for i in range(101):
if i%2 != 0:
sum = sum + i
print(sum)
\ 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