Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
bellcode
/
lesson2-5_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
2d935255
authored
3 years ago
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
save project
parent
a13f5bbc
c18082l760p219a8057/wx170728
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
31 additions
and
27 deletions
123.py
diy1.py
123.py
View file @
2d935255
import
turtle
import
turtle
pen
=
turtle
.
Pen
()
# pen = turtle.Pen()
pen
.
write
(
"锄禾日当午,
\n
汗滴禾下土。"
,
font
=
(
"Times"
,
30
,
"normal"
))
# pen.write("锄禾日当午,\n汗滴禾下土。",font=("Times",30,"normal"))
pen
.
hideturtle
()
# pen.hideturtle()
turtle
.
done
# turtle.done()
\ No newline at end of file
pen
=
turtle
.
Pen
()
pen
.
shape
(
"turtle"
)
pen
.
left
(
45
)
forward
(
100
)
pen
.
extent
(
50
,
180
)
pen
.
right
(
90
)
pen
.
extent
(
50
,
180
)
forward
(
100
)
turtle
.
done
()
\ No newline at end of file
This diff is collapsed.
Click to expand it.
diy1.py
View file @
2d935255
#
import
turtle
while
True
:
# pen = turtle.Pen()
player
=
input
(
"请出拳(石头/剪刀/布):"
)
# pen.write("锄禾日当午,\n汗滴禾下土。",font=("Times",30,"normal"))
print
(
"玩家出拳:"
+
player
)
# pen.hideturtle()
import
random
# turtle.done()
list
=
[
"石头"
,
"剪刀"
,
"布"
]
pen1
=
turtle
.
Pen
()
computer
=
random
.
choice
(
list
)
pen1
.
shape
(
"turtle"
)
print
(
"电脑出拳:"
+
computer
)
pen1
.
color
(
"green"
)
if
player
in
list
:
pen1
.
pensize
(
5
)
if
player
==
computer
:
pen1
.
left
(
45
)
input
(
"平局"
)
pen1
.
forward
(
100
)
elif
(
player
==
"石头"
)
and
(
computer
==
"剪刀"
):
pen1
.
circle
(
50
,
180
)
input
(
"赢了"
)
pen1
.
right
(
90
)
elif
(
player
==
"布"
)
and
(
computer
==
"石头"
):
pen1
.
circle
(
50
,
180
)
input
(
"赢了"
)
pen1
.
forward
(
100
)
elif
(
player
==
"剪刀"
)
and
(
computer
==
"布"
):
pen1
.
turtle
.
hide
input
(
"赢了"
)
turtle
.
done
()
else
:
print
(
"输了"
)
else
:
print
(
"输入错误"
)
\ No newline at end of file
This diff is collapsed.
Click to expand it.
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