Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Administrator
/
lesson14_2
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
de101e86
authored
Jun 25, 2022
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
auto save
parent
47e75038
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
78 additions
and
16 deletions
diy2.py
diy3.py
diy4.py
diy5.py
diy2.py
View file @
de101e86
class
Hero
:
import
turtle
def
__init__
(
self
,
name
,
hp
,
attar
):
pen
=
turtle
.
Pen
()
self
.
level
=
1
pen
.
penup
()
self
.
name
=
name
pen
.
goto
(
0
,
-
200
)
self
.
hp
=
hp
pen
.
pendown
()
self
.
attar
=
attar
pen
.
circle
(
200
)
pen
.
penup
()
def
updent
(
self
):
pen
.
goto
(
-
100
,
50
)
self
.
level
=
self
.
level
+
1
pen
.
pendown
()
self
.
hp
=
self
.
hp
+
40
pen
.
fillcolor
(
"blue"
)
self
.
attar
=
self
.
attar
+
5
pen
.
begin_fill
()
yase
=
Hero
(
"亚瑟"
,
300
,
10
)
pen
.
circle
(
20
)
yase
.
updent
()
pen
.
end_fill
()
print
(
"等级是"
+
str
(
yase
.
level
))
pen
.
penup
()
print
(
"血量"
+
str
(
yase
.
hp
))
pen
.
goto
(
100
,
50
)
print
(
"攻击"
+
str
(
yase
.
attar
))
pen
.
pendown
()
pen
.
fillcolor
(
"blue"
)
pen
.
begin_fill
()
pen
.
circle
(
20
)
pen
.
end_fill
()
pen
.
penup
()
pen
.
goto
(
0
,
50
)
pen
.
pendown
()
pen
.
circle
(
-
50
,
steps
=
3
)
pen
.
penup
()
pen
.
goto
(
-
150
,
-
70
)
pen
.
pendown
()
pen
.
goto
(
0
,
-
170
)
pen
.
goto
(
150
,
-
70
)
turtle
.
done
()
\ No newline at end of file
diy3.py
0 → 100644
View file @
de101e86
import
turtle
import
random
pen
=
turtle
.
Pen
()
pen
.
penup
()
pen
.
goto
(
0
,
-
120
)
pen
.
pendown
()
pen
.
circle
(
120
)
pen
.
penup
()
pen
.
pendown
()
def
inn
():
pen
.
goto
(
0
,
0
)
pen
.
fillcolor
(
"yellow"
)
pen
.
begin_fill
()
pen
.
forward
(
120
)
pen
.
left
(
30
)
pen
.
forward
(
80
)
pen
.
right
(
60
)
pen
.
forward
(
80
)
pen
.
right
(
120
)
pen
.
forward
(
80
)
pen
.
right
(
60
)
pen
.
forward
(
80
)
pen
.
right
(
150
)
pen
.
end_fill
()
for
i
in
range
(
12
):
inn
()
pen
.
right
(
30
)
turtle
.
done
()
\ No newline at end of file
diy4.py
0 → 100644
View file @
de101e86
m
=
int
(
input
(
"请输入一个正整数"
))
n
=
int
(
input
(
"请输入一个正整数"
))
s
=
""
c
=
n
if
m
>
n
:
n
=
m
m
=
c
for
i
in
range
(
m
,
n
+
1
):
if
i
%
7
==
0
and
i
%
5
!=
0
:
s
=
s
+
str
(
i
)
+
","
print
(
s
[
0
:
len
(
s
)
-
1
])
\ No newline at end of file
diy5.py
0 → 100644
View file @
de101e86
list1
=
[
1
,
2
,
3
,
4
,
5
,
6
]
list1
.
append
(
100
)
list
.
insert
(
0
,
1000
)
list1
[
3
]
=
20
list
.
pop
(
2
)
list
[
2
:
6
]
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