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
03348f60
authored
Jan 09, 2022
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
auto save
parent
8b6151a1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
23 deletions
diy1.py
diy2.py
diy1.py
View file @
03348f60
import
random
import
turtle
# 玩家出拳
p
=
turtle
.
Pen
()
sjb
=
input
(
"请出拳"
)
print
(
"玩家出拳:"
+
sjb
)
#电脑出拳
list
=
[
"石头"
,
"剪刀"
,
"布"
]
dn
=
random
.
choice
(
list
)
print
(
"电脑出拳:"
+
dn
)
if
sjb
in
list
:
print
(
"输入正确"
)
if
sjb
==
dn
:
print
(
"平局"
)
elif
sjb
==
"石头"
and
dn
==
"剪刀"
:
print
(
"赢了"
)
elif
sjb
==
"剪刀"
and
dn
==
"布"
:
print
(
"赢了"
)
elif
sjb
==
"布"
and
dn
==
"石头"
:
print
(
"赢了"
)
else
:
print
(
"输了"
)
else
:
print
(
"输入有误:请重新输入!"
)
\ No newline at end of file
diy2.py
0 → 100644
View file @
03348f60
#导入turtle
import
turtle
#创建画笔
p
=
turtle
.
Pen
()
#写入文字
screen
=
turtle
.
Screen
()
screen
.
bgcolor
(
"light blue"
)
p
.
write
(
"jijiyyy"
,
font
=
(
"Times"
,
30
,
"normal"
))
p
.
hideturtle
()
p1
=
turtle
.
Pen
()
p1
.
shape
(
"turtle"
)
p1
.
penup
()
p1
.
goto
(
-
100
,
100
)
p1
.
pensize
(
5
)
p1
.
pencolor
(
"red"
)
len
=
30
p1
.
pendown
()
p1
.
left
(
45
)
p1
.
forward
(
2
*
len
)
p1
.
circle
(
len
,
180
)
p1
.
right
(
90
)
p1
.
circle
(
len
,
180
)
p1
.
forward
(
2
*
len
)
p1
.
hideturtle
()
turtle
.
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