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
ab6543c6
authored
May 14, 2023
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
auto save
parent
4cac003e
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
54 additions
and
3 deletions
diy1.py
jiji.py
diy1.py
View file @
ab6543c6
neme
=
input
(
"输入名字"
)
print
(
neme
+
"你好啊"
)
\ No newline at end of file
import
random
player
=
input
(
"请出拳:石头/剪刀/布"
)
computerlist
=
[
"石头"
,
"剪刀"
,
"布"
]
computer
=
random
.
choice
(
computerlist
)
#
if
player
in
computerlist
:
if
player
==
computer
:
print
(
"这局平局,再来一局"
)
elif
(
player
==
"石头"
and
computer
==
"剪刀"
)
or
(
player
==
"剪刀"
and
computer
==
"布"
)
or
(
player
==
"布"
and
computer
==
"石头"
):
print
(
"玩家获胜"
)
else
:
print
(
"输了"
)
else
:
print
(
"输入错误重新输入"
)
print
(
"玩家出拳:"
+
player
)
print
(
"电脑出拳:"
+
computer
)
jiji.py
0 → 100644
View file @
ab6543c6
import
turtle
#导入画笔
pen
=
turtle
.
pen
()
#创建画笔
pen
.
penup
()
#抬笔
pen
.
goto
(
-
100
,
100
)
#移动到坐标
pen
.
pendown
()
#落笔
for
i
in
range
(
4
):
#循环4次
pen
.
forward
(
200
)
#移动200步
pen
.
right
(
90
)
#右转90度
pen
.
penup
()
#抬笔
pen
.
goto
(
0
,
-
50
)
#移动到坐标
pen
.
pendown
()
#落笔
pen
.
fillcolo
(
"blue"
)
#设置填充颜色
pen
.
degin_fill
()
#开始填充
pen
.
circle
(
50
)
#半径50的圆
pen
.
end_fill
()
#结束填充
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