Commit d130dc54 by BellCodeEditor

auto save

parent 5fed6ca8
Showing with 3 additions and 19 deletions
class Hero:
def __init__(self,姓名,血量,攻击力):
self.等级=1
self.姓名=姓名
self.血量=血量
self.攻击力=攻击力
def 升级(self):
self.等级=self.等级+1
self.血量=self.血量+50
self.攻击力=self.攻击力+5
瑞雯=Hero("瑞雯",300,20)
习景舒=Hero("习景舒",999,299)
print("习景舒的攻击力为",习景舒.攻击力)
print("瑞雯的攻击力为",瑞雯.攻击力)
瑞雯.升级()
习景舒.升级()
print("习景舒的攻击力为",习景舒.攻击力)
print("瑞雯的攻击力为",瑞雯.攻击力)
\ No newline at end of file
for i in range(3):
print(' '*(4-i))
\ 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