Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Administrator
/
lesson5_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
df0b1729
authored
Jan 10, 2021
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
save project
parent
faf8dd05
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
51 additions
and
0 deletions
diy1.py
diy2.py
diy1.py
0 → 100644
View file @
df0b1729
"""
使用turtle模块画图
每次移动都增加画笔移动的长度,并旋转91°,重复执行300次,查看效果
"""
import
turtle
a
=
[
"red"
,
"orange"
,
"yellow"
,
"green"
,
"aqua"
,
"blue"
,
"purple"
]
pen
=
turtle
.
Pen
()
pen
.
speed
(
20
)
screen
=
turtle
.
Screen
()
screen
.
bgcolor
(
"black"
)
# 请创造师在下面接着创作
for
i
in
range
(
1
,
10000
,
1
):
pen
.
color
(
a
[
i
%
7
])
pen
.
forward
(
i
)
pen
.
left
(
360
/
7
+
2
)
# 隐藏画笔,保存画布
pen
.
hideturtle
()
turtle
.
done
()
\ No newline at end of file
diy2.py
0 → 100644
View file @
df0b1729
i
=
10
import
turtle
pen
=
turtle
.
Pen
turtle
.
hideturtle
()
turtle
.
bgcolor
(
'light yellow'
)
username
=
[
'1'
,
'2'
,
'3'
,
'4'
,
'5'
,
'6'
,
'7'
,
'8'
,
'9'
,
'10'
]
userpassword
=
[
'1'
,
'2'
,
'3'
,
'4'
,
'5'
,
'6'
,
'7'
,
'8'
,
'9'
,
'10'
]
while
True
:
if
i
!=
0
:
x
=
0
usernameS
=
turtle
.
textinput
(
'登录'
,
'请输入username'
)
for
a
in
range
(
10
):
if
username
[
a
]
==
usernameS
:
x
=
1
break
if
x
!=
1
:
pen
.
write
(
"用户名不存在"
,
font
=
(
"times"
,
15
,
"normal"
))
else
:
userpasswordS
=
turtle
.
textinput
(
'登录'
,
'请输入userpassword'
)
if
userpassword
[
a
]
==
userpasswordS
:
pen
.
write
(
"请输入userpassword"
,
font
=
(
"times"
,
15
,
"normal"
))
break
else
:
pen
.
write
(
'密码输入错误'
,
font
=
(
"times"
,
15
,
"normal"
))
i
-=
1
if
i
!=
0
:
pen
.
write
(
'温馨提示:还剩'
+
str
(
i
)
+
'次机会'
,
font
=
(
"times"
,
15
,
"normal"
))
else
:
pen
.
write
(
'输入次数用完,账户已锁定'
,
font
=
(
"times"
,
15
,
"normal"
))
turtle
.
done
()
exit
()
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