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
d5c71593
authored
Nov 21, 2021
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
auto save
parent
ee7122bc
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
6 deletions
diy1.py
diy1.py
View file @
d5c71593
import
random
if
player
in
lift
:
# 玩家出拳
if
player
in
list
:
player
=
input
(
"出拳"
)
print
(
"玩家出了,"
+
player
)
list
=
[
"石头"
,
"剪刀"
,
"布"
]
ai
=
random
.
choice
(
list
)
print
(
"机器出了,"
+
ai
)
if
player
==
ai
:
print
(
"平局"
)
elif
(
player
==
"布"
and
ai
==
"石头"
)
or
(
player
==
"石头"
and
ai
==
"剪刀"
)
or
(
player
==
"剪刀"
and
ai
==
"布"
):
print
(
"玩家获胜"
)
if
player
==
ai
:
print
(
"平局"
)
elif
(
player
==
"布"
and
ai
==
"石头"
)
or
(
player
==
"石头"
and
ai
==
"剪刀"
)
or
(
player
==
"剪刀"
and
ai
==
"布"
):
print
(
"玩家获胜"
)
else
:
print
(
"玩家失败"
)
print
(
"玩家失败"
)
else
:
print
(
"你TM眼真大啊"
)
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