Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
bellcode
/
lesson2-2_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
8859e663
authored
Apr 01, 2023
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
save project
parent
81843895
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
2 deletions
diy1.py
diy1.py
View file @
8859e663
p
=
input
(
"玩家猜拳 石头剪刀布"
)
p
=
input
(
"玩家猜拳 石头剪刀布"
)
print
(
"玩家出:"
+
p
)
print
(
"玩家出:"
+
p
)
\ No newline at end of file
import
random
d
=
[
'石头'
,
'剪刀'
,
'布'
]
if
p
in
d
:
d
=
random
.
choice
(
d
)
print
(
"电脑出:"
+
d
)
if
(
p
==
d
):
print
(
"平局"
)
elif
(
p
==
"剪刀"
and
d
==
"布"
)
or
(
p
==
"石头"
and
d
==
"剪刀"
)
or
(
p
==
"布"
and
d
==
"石头"
):
print
(
"我们赢了"
)
else
:
print
(
"我们输了"
)
else
:
print
(
"你输入错了"
)
\ 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