Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Administrator
/
lesson5_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
f64ca328
authored
May 21, 2022
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
auto save
parent
df1dd66f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
4 deletions
diy.PY
diy.PY
View file @
f64ca328
import
turtle
# 导入turtle模块
pen
=
turtle
.
Pen
()
# 创建画笔
distance
=
1
# 建立变量distance设为1
for
i
in
range
(
300
):
# for循环用range()方法重复执行300次
pen
.
forward
(
distance
)
# 变量distance表示画笔移动的距离
distance
+=
1
# 每次循环变量distance增加1
for
i
in
range
(
1
,
300
):
pen
.
forward
(
i
)
# 变量1表示画笔移动的距离
pen
.
right
(
91
)
# 右转91
pen
.
hideturtle
()
# 隐藏画笔
turtle
.
done
()
# 暂停重新,停止画笔绘制 turtle.done()
\ 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