Commit ac3bf442 by BellCodeEditor

auto save

parent ef39df1c
Showing with 38 additions and 4 deletions
class hero:
class Hero:
def __init__(self):
self.level=1
self.hp=300
self.attack=2000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
self.level = 1
self.hp= 300
self.attack= 20 # attack:攻击
libai = Hero()
print("豆豆的血量值为:",libai.hp)
print("项羽的血量值为:",libai.attack)
\ No newline at end of file
class Hero:
def __init__(self, name, hp, attack):
self.level = 1
self.name = name # name:名字
self.hp= hp
self.attack= attack # attack:攻击
xiangyu= Hero("项羽",300,20)
xishi = Hero("西施",240,23)
print("项羽的血量为:",xiangyu.hp)
print("西施的血量为:",xishi.hp)
\ No newline at end of file
class Hero:
def __init__(self, name, hp, attack):
self.level = 1
self.name = name # name:名字
self.hp= hp
self.attack= attack
def upgrade():
libai.level=libai.level+1
libai.hp=libai.hp+50
libai.attack=libai.attack+4
libai = Hero("李白",300,20)
print("李白的初始血量值为:",libai.hp)
upgrade()
upgrade()
print("升级3次后,垭瑟的血量值为:",libai.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