Commit 12e44b3b by BellCodeEditor

auto save

parent f47689a4
Showing with 15 additions and 0 deletions
#定义一个英雄类(Hero)
class Hero:
#定义init方法
def __init__(self):
#定义属性值(level=1,hp=300,attack=20)
self.level=1
self.hp=300
self.attack=20
#实例对象yase
yase=Hero()
#打印yase的血量hp
print('亚瑟的血量为:'+str(yase.hp))
#打印yase的攻击力attack
print('亚瑟的攻击力为:'+str(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