Commit 516efaac by BellCodeEditor

save project

parent 5ae6cf6d
Showing with 11 additions and 21 deletions
# 英雄角色类
class Hero(object):
def __init__(self, name):
self.level = 1
self.hp = 250
self.attack = 40
self.name = name
from pyecharts.charts import Bar
def combat(self,enemy): # 攻击
enemy.hp-=self.attack
info1=self.name+"对"+enemy.name+"发起进攻,"
info2="造成"+str(self.attack)+"点伤害,"
if enemy.hp>0:
info3=info3=enemy.name+"还剩"+str(enemy.hp)+"点血。"
info=info1+info2+info3
print(info)
else:
info3=enemy.name+"死亡,游戏结束。"
yase = Hero("垭瑟")
houyi= Hero("后羿")
yase.combat(houyi)
\ No newline at end of file
subjects=["语文","数学","英语","地理",
"历史","政治","生物","化学","物理"]
scores = [88, 95, 96, 94, 62, 66, 64, 93, 89]
# 创建对应的图表对象
bar = Bar()
# 传入x轴和y轴的数据
bar.add_xaxis(subjects)
bar.add_yaxis("浈浈的成绩", scores)
# 保存到本地文件
bar.render("analysis.html")
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