Commit f3e4f1cb by BellCodeEditor

auto save

parent f47689a4
Showing with 25 additions and 0 deletions
class Hero:# "亚瑟",20,100
def __init__(self,name,hp,attack):# 等级 姓名 血量 攻击
self.level = 1
self.name = name
self.hp= hp
self.attack= attack # attack:攻击
yase = Hero("亚瑟",20,100)
houyi = Hero("后羿",200,10)
print("yase的血量值为:",yase.hp) #20
print("yase的攻击力为:",yase.attack)# 100
print("houyi的血量值为:",houyi.hp) #20
print("yase的攻击力为:",yase.attack)# 100
\ No newline at end of file
class Hero:
class Hero:
def __init__(self):
self.level = 1
self.hp= 300
self.attack= 20 # attack:攻击
yase = Hero()
print("yase的血量值为:",yase.hp)
print("yase的攻击力为:",yase.attack)
\ 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