Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
bellcode
/
lesson13-5
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
60da3c37
authored
Jun 22, 2024
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
save project
parent
a65b4a02
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
2 deletions
Hero.py
eee.py
Hero.py
0 → 100644
View file @
60da3c37
class
Hero
:
def
__init__
(
self
,
name
):
self
.
name
=
name
self
.
level
=
1
self
.
attack
=
40
self
.
hp
=
250
def
combat
(
self
,
enemy
):
info1
=
self
.
name
+
'对'
+
enemy
.
name
+
'发起进攻,'
info2
=
'造成'
+
str
(
self
.
attack
)
+
'点伤害,'
enemy
.
hp
-=
self
.
attack
if
enemy
.
hp
>
0
:
info3
=
enemy
.
name
+
'还剩下'
+
str
(
enemy
.
hp
)
+
'血量'
info
=
info1
+
info2
+
info3
print
(
info
)
else
:
info3
=
enemy
.
name
+
'阵亡,游戏结束'
info
=
info1
+
info2
+
info3
print
(
info
)
exit
()
yase
=
Hero
(
'亚瑟'
)
houyi
=
Hero
(
'后羿'
)
yase
.
combat
(
houyi
)
\ No newline at end of file
eee.py
View file @
60da3c37
...
@@ -21,7 +21,6 @@ for i in a:
...
@@ -21,7 +21,6 @@ for i in a:
for
sales
in
data
[
1
:]:
for
sales
in
data
[
1
:]:
sum
=
sum
+
int
(
sales
)
sum
=
sum
+
int
(
sales
)
result
=
data
[
0
]
+
str
(
sum
)
+
'
\n
'
result
=
data
[
0
]
+
str
(
sum
)
+
'
\n
'
print
(
result
)
final_sum
.
append
(
result
)
final_sum
.
append
(
result
)
with
open
(
r"C:\Users\Administrator\Desktop\new_sales_list.txt"
,
'a'
,
encoding
=
'utf-8'
)
as
file
:
with
open
(
r"C:\Users\Administrator\Desktop\new_sales_list.txt"
,
'a'
,
encoding
=
'utf-8'
)
as
file
:
file
.
writelines
(
final_sum
)
file
.
writelines
(
final_sum
)
\ No newline at end of file
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