Commit 0321f519 by BellCodeEditor

auto save

parent d6496433
Showing with 11 additions and 37 deletions
class Hero:
class Hero:
class Hero:
def __init__(self, name, hp, attack):
self.level = 1
self.name = name
self.hp= hp
self.attack= attack
def upgrade():
yase.level=yase.level+2
yase.hp=yase.hp+50
yase.attack=yase.attack+4
yase = Hero("亚瑟",300,20)
print("亚瑟的初始血量值为:",yase.hp)
print("亚瑟的初始等级为:",attack.hp)
upgrade()
upgrade()
upgrade()
upgrade()
upgrade()
upgrade()
upgrade()
upgrade()
print("升级6次后,亚瑟的血量值为:",yase.hp)
print("升级6次后,亚瑟的攻击力为:",yas.level)
\ No newline at end of file
def __init__(self):
self.level = 9
self.hp= 999
self.attack= 999
xiangyu = Hero()
print("项羽的血量值为:",xiangyu .hp)
print("项羽的攻击力为:",xiangyu .attack)
\ No newline at end of file
class Hero:
++ "b/1\343\200\202py/2.py"
class Hero:
def __init__(self, name, hp, attack):
self.level = 1
self.name = name
self.hp= hp
self.attack= attack
yase = Hero("亚瑟",300,20)
houyi = Hero("后羿",240,23)
print("亚瑟的血量为:",yase.hp,"亚瑟的攻击力:",yase.attack)
print("后羿的血量为:",houyi.hp,"后羿的攻击力:",houyi.attack)
\ No newline at end of file
++ "b/1\343\200\202py/fff.py"
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