Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
bellcode
/
lesson13-3
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
855d84ea
authored
Nov 26, 2022
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
save project
parent
79441706
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
163 additions
and
11 deletions
1.yy
12.py
S1.py
1.yy
0 → 100644
View file @
855d84ea
import turtle
pen=turtle.
\ No newline at end of file
12.py
View file @
855d84ea
with
open
(
r'c:\Users\Administrator.PC-20211209SJWK\Desktop\xmh.txt.txt'
,
'r'
,
encoding
=
'utf-8'
)
as
file
:
import
turtle
a
=
file
.
readlines
()
pen
=
turtle
.
Pen
()
for
i
in
a
:
pen
.
pensize
(
5
)
data
=
i
.
split
()
pen
.
color
(
"red"
)
#print(data[1:])
pen
.
up
()
sum
=
0
pen
.
right
(
90
)
for
sales
in
data
[
1
:]:
pen
.
forward
(
200
)
sum
=
sum
+
int
(
sales
)
pen
.
left
(
90
)
result
=
data
[
0
]
str
[
sum
]
pen
.
down
()
print
(
result
)
pen
.
fillcolor
(
"red"
)
\ No newline at end of file
pen
.
begin_fill
()
pen
.
circle
(
200
)
pen
.
end_fill
()
pen
.
up
()
pen
.
left
(
90
)
pen
.
forward
(
30
)
pen
.
right
(
90
)
pen
.
down
()
pen
.
fillcolor
(
"white"
)
pen
.
begin_fill
()
pen
.
circle
(
170
)
pen
.
end_fill
()
pen
.
up
()
pen
.
left
(
90
)
pen
.
forward
(
40
)
pen
.
right
(
90
)
pen
.
down
()
pen
.
fillcolor
(
"red"
)
pen
.
begin_fill
()
pen
.
circle
(
130
)
pen
.
end_fill
()
pen
.
up
()
pen
.
left
(
90
)
pen
.
forward
(
30
)
pen
.
right
(
90
)
pen
.
down
()
pen
.
fillcolor
(
"blue"
)
pen
.
begin_fill
()
pen
.
circle
(
100
)
pen
.
end_fill
()
pen
.
up
()
pen
.
goto
(
-
200
,
0
)
pen
.
down
()
pen
.
fillcolor
(
"white"
)
pen
.
begin_fill
()
for
count
in
range
(
5
):
turtle
.
forward
(
200
)
turtle
.
right
(
144
)
pen
.
end_fill
()
pen
.
hideturtle
()
turtle
.
done
()
\ No newline at end of file
S1.py
0 → 100644
View file @
855d84ea
# import turtle
# pen=turtle.Pen()
# pen.color("black")
# pen.speed(1)
# pen.up()
# pen.left(270)
# pen.forward(100)
# pen.right(90)
# pen.forward(100)
# pen.down()
# pen.left(180)
# pen.forward(200)
# pen.left(90)
# pen.forward(200)
# pen.left(90)
# pen.forward(200)
# pen.left(90)
# pen.forward(200)
# pen.left(90)
# pen.forward(100)
# pen.fillcolor("red")
# pen.begin_fill()
# pen.left(45)
# pen.forward(142)
# pen.left(90)
# pen.forward(142)
# pen.left(90)
# pen.forward(142)
# pen.left(90)
# pen.forward(142)
# pen.end_fill()
# pen.hideturtle()
# turtle.done()
# x=True
# def printLine(text):
# print(text,'Runoob')
# printLine('Python')
# result=lambda x: x*x
# print(result(5))
# def Foo(x):
# if (x==1):
# return 1
# else:
# return x+Foo(x-1)
# print(Foo(4))
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
=
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
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