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
ef937778
authored
Nov 17, 2024
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
auto save
parent
d044d7b9
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
32 additions
and
19 deletions
diy1.py
o.py
r.py
diy1.py
View file @
ef937778
"""
s1
=
{
"数学"
:
100
,
"语文"
:
100
}
使用turtle模块画图
s2
=
{
"数学"
:
109
,
"语文"
:
123
}
每次移动都增加画笔移动的长度,并旋转91°,重复执行300次,查看效果
s3
=
{
"数学"
:
123
,
"语文"
:
187
}
"""
sc
=
{
"小贝"
:
s1
,
"小胡"
:
s2
,
"小空"
:
s3
}
import
turtle
while
True
:
m
=
input
(
"请输入姓名:"
)
if
m
==
"stop"
:
break
if
m
in
sc
:
print
(
m
+
"同学,请查收你的成绩单:"
+
str
(
sc
[
m
]))
print
(
"*"
*
20
)
else
:
print
(
"抱歉,你的成绩未收录其中"
)
print
(
"*"
*
20
)
pen
=
turtle
.
Pen
()
screen
=
turtle
.
Screen
()
\ No newline at end of file
screen
.
bgcolor
(
"light pink"
)
colors
=
[
"white"
,
"blue"
,
"violet"
,
"cyan"
]
# 请创造师在下面接着创作
distance
=
1
pen
.
speed
(
1000
)
for
i
in
range
(
1
,
300
):
pen
.
pencolor
(
colors
[
i
%
4
])
pen
.
forward
(
i
)
pen
.
right
(
91
)
# 隐藏画笔,保存画布
pen
.
hideturtle
()
turtle
.
done
()
o.py
0 → 100644
View file @
ef937778
import
random
list
=
[
"刘"
,
"王"
,
"贵"
]
a
=
random
.
choice
(
list
)
print
(
"上台分享的是:"
+
a
)
\ No newline at end of file
r.py
0 → 100644
View file @
ef937778
file
=
open
(
r"C:\Users\29018\Desktop\ddd.txt"
,
'w'
,
encoding
=
'utf-8'
)
file
.
write
(
"不"
)
file
.
close
()
with
open
(
r"C:\Users\29018\Desktop\ddd.txt"
,
'r'
,
encoding
=
'utf-8'
)
as
file
:
for
i
in
file
:
if
"jin"
in
i
:
file
.
replace
(
"jin"
,
"发)
else:
print("
bu
")
\ 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