Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Administrator
/
level3-lesson15-diy3
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
2c40cd48
authored
Jul 28, 2021
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
auto save
parent
6f6a737d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
7 deletions
hfd.py
my_tree.py
hfd.py
0 → 100644
View file @
2c40cd48
num_list
=
[
1
,
3
,
5
,
8
,
11
,
15
,
17
,
18
,
20
,
21
]
mid
=
(
low
+
high
)
//
2
guess
=
num_list
[
mid
]
if
guess
==
17
:
print
(
"zhao"
)
\ No newline at end of file
my_tree.py
View file @
2c40cd48
import
turtle
import
random
pen
=
turtle
.
Turtle
()
colors
=
[
'snow'
,
'lightcoral'
]
pen
.
color
(
'sienna'
)
# 画布大小
w
=
turtle
.
Screen
()
...
...
@@ -11,17 +12,27 @@ pen.penup()
pen
.
backward
(
150
)
pen
.
down
()
def
tree
(
n
):
if
n
>=
50
:
if
n
>=
0
:
if
n
<=
12
:
color
=
random
.
choice
(
colors
)
pen
.
pencolor
(
color
)
pen
.
pensize
(
n
/
2
)
else
:
pen
.
pensize
(
n
/
10
)
pen
.
pencolor
(
'sienna'
)
pen
.
forward
(
n
)
pen
.
right
(
30
)
tree
(
n
-
10
)
pen
.
left
(
60
)
tree
(
n
-
10
)
pen
.
right
(
30
)
a
=
random
.
randint
(
0
,
30
)
l
=
random
.
randint
(
1
,
15
)
pen
.
right
(
a
)
tree
(
n
-
l
)
pen
.
left
(
2
*
a
)
tree
(
n
-
l
)
pen
.
right
(
a
)
pen
.
up
()
pen
.
backward
(
n
)
pen
.
down
()
tree
(
100
)
tree
(
70
)
# 移动到起点
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