Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
bellcode
/
lesson2-1-1_DIY1
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
ccd013b6
authored
Apr 24, 2021
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
save project
parent
8b0ac80c
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
43 additions
and
7 deletions
diy1.py
diyyuan.py
s.py
diy1.py
deleted
100644 → 0
View file @
8b0ac80c
name
=
input
(
"勇于挑战的创造师你叫什么呀?"
)
print
(
name
+
",你好呀"
)
\ No newline at end of file
diyyuan.py
0 → 100644
View file @
ccd013b6
import
turtle
pen1
=
turtle
.
Pen
()
pen1
.
pensize
(
10
)
pen1
.
pencolor
(
"black"
)
pen1
.
left
(
45
)
pen1
.
forward
(
100
)
pen1
.
circle
(
50
,
180
)
pen1
.
right
(
90
)
pen1
.
circle
(
50
,
180
)
pen1
.
forward
(
100
)
pen1
.
hideturtle
()
turtle
.
done
()
s.py
View file @
ccd013b6
s
=
input
(
"请输入颜色"
)
a
=
input
(
"请输入边数"
)
color
=
input
(
"请输入颜色"
)
bianshu
=
input
(
"请输入边数"
)
import
random
import
turtle
\ No newline at end of file
import
turtle
import
sys
if
bianshu
==
"随机"
:
bianshuint
=
random
.
randrange
(
1
,
10
)
else
:
if
bianshu
.
isdigit
()
and
int
(
bianshu
)
!=
0
:
bianshuint
=
int
(
bianshu
)
else
:
print
(
"边数输入错误"
)
sys
.
exit
(
0
)
colorlist
=
[
"red"
,
"yellow"
,
"blue"
,
"black"
,
"green"
,
"pink"
]
if
color
==
"随机"
:
color
=
random
.
choice
(
colorlist
)
else
:
if
color
not
in
colorlist
:
print
(
"颜色输入错误"
)
p
=
turtle
.
Pen
()
#4.1画笔
p
.
color
(
color
)
#4.2画笔颜色
p
.
fillcolor
(
color
)
#4.3填充颜色
p
.
begin_fill
()
#4.4填充开始
#(n-2)*180(n==边数)
angle
=
180
*
(
bianshuint
-
2
)
/
bianshuint
#n边形内角和除以n得到n边形外角的值
for
i
in
range
(
bianshuint
):
p
.
forward
(
1
)
p
.
left
(
180
-
angle
)
#求补角得到内角
p
.
end_fill
()
#4.5填充结束
p
.
hideturtle
()
#4.6隐藏
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