Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
bellcode
/
lesson15_1
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
516efaac
authored
Nov 06, 2021
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
save project
parent
5ae6cf6d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
22 deletions
diy1.py
diy1.py
View file @
516efaac
# 英雄角色类
class
Hero
(
object
):
def
__init__
(
self
,
name
):
self
.
level
=
1
self
.
hp
=
250
self
.
attack
=
40
self
.
name
=
name
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
from
pyecharts.charts
import
Bar
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"
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment