Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
bellcode
/
lesson6-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
ceab9b57
authored
Apr 30, 2022
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
save project
parent
78a3ec3c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
86 additions
and
14 deletions
SDFz.py
diy.py
SDFz.py
0 → 100644
View file @
ceab9b57
import
turtle
as
t
import
time
t
.
speed
(
100
)
t
.
bgcolor
(
"black"
)
t
.
pencolor
(
"blue"
)
t
.
pensize
(
2
)
t
.
hideturtle
()
t
.
tracer
(
0
)
while
True
:
for
i
in
range
(
30
):
for
o
in
range
(
6
):
t
.
fd
(
150
)
t
.
right
(
60
)
t
.
right
(
12
)
t
.
update
()
t
.
clear
()
time
.
sleep
(
0.02
)
\ No newline at end of file
diy.py
View file @
ceab9b57
# 和你的小伙伴用列表讲讲桃园结义的故事,并说说这其中运用了哪些列表知识:
# 来,我给你起个头~
# 从前啊,有三个bro,分别是:刘备、关羽、张飞...
bro1
=
"关羽"
bro2
=
"刘备"
bro3
=
"张飞"
bros
=
[
"刘备"
,
"关羽"
,
"张飞"
]
bro1
=
[
"关羽"
,
160
,
8.5
]
bro2
=
[
"刘备"
,
161
,
9.1
]
bro3
=
[
"张飞"
,
166
,
8.3
]
bros
[
0
]
=
"关羽"
bros
[
1
]
=
"刘备"
print
(
bros
)
\ No newline at end of file
import
turtle
import
random
from
turtle
import
*
from
time
import
sleep
#画樱花的躯干
def
tree
(
branchLen
,
t
):
#branchlen树脂长度,T表示turtle对象
sleep
(
0.0005
)
if
branchLen
>
3
:
if
8
<=
branchLen
<=
12
:
if
random
.
randint
(
0
,
2
)
==
0
:
t
.
color
(
"snow"
)
#白
else
:
t
.
color
(
"lightcoral"
)
#淡三湖色
t
.
pensize
(
branchLen
/
3
)
elif
branchLen
<
8
:
if
random
.
randint
(
0.001
)
==
0
:
t
.
color
(
"snow"
)
else
:
t
.
color
(
"lightcoral"
)
t
.
pensize
(
branchLen
/
2
)
else
:
t
.
color
(
"sienna"
)
#樍色
t
.
pensize
(
branchLen
/
10
)
t
.
forward
(
branchLen
)
a
=
1.5
*
random
.
random
()
t
.
right
(
20
*
b
)
b
=
1.5
*
random
.
random
()
tree
(
branchLen
-
10
*
a
,
t
)
t
.
left
(
40
*
a
)
tree
(
branchLen
-
10
*
a
,
t
)
t
.
right
(
20
*
b
)
t
.
up
()
t
.
backwark
(
branchLen
)
t
.
down
()
def
petal
(
m
,
t
):
for
i
in
range
(
m
):
a
=
200
-
400
*
random
.
random
()
b
=
10
-
20
*
random
.
random
()
t
.
up
()
t
.
forward
(
a
)
t
.
left
(
90
)
t
.
forward
(
b
)
t
.
down
()
t
.
color
(
"lightcoral"
)
t
.
circle
(
1
)
t
.
up
()
t
.
backward
(
a
)
t
.
right
(
90
)
t
.
forward
(
b
)
def
main
():
t
=
turtle
.
Turtle
()
w
=
turtle
.
Screen
()
t
.
hideturtle
()
getscreen
()
.
tracer
(
5
,
0
)
w
.
screensize
(
bg
=
'wheat'
)
t
.
left
(
90
)
t
.
up
()
t
.
backward
(
150
)
t
.
down
()
t
.
color
(
"sienna"
)
tree
(
60
,
t
)
petal
(
200
,
t
)
w
.
exitonclick
()
main
()
t
.
done
()
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