Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Administrator
/
lesson1_4
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
fa2bf2a7
authored
Jun 05, 2022
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
save project
parent
978385cf
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
3 deletions
day.py
day.py
View file @
fa2bf2a7
name
=
input
(
"请出(石头/剪刀/布)"
)
name
=
input
(
"请出(石头/剪刀/布)"
)
print
(
"玩家:"
+
name
)
print
(
"玩家:"
+
name
)
import
random
import
random
a
=
[
"(石头/剪刀/布)"
]
a
=
[
"石头"
,
"剪刀"
,
"布"
]
com
=
random
.
choice
(
a
)
ai
=
random
.
choice
(
a
)
print
(
"人机:"
+
com
)
print
(
"人机:"
+
ai
)
if
name
==
"石头"
and
ai
==
"石头"
:
print
(
"平局"
)
elif
name
==
"布"
and
ai
==
"石头"
:
print
(
"玩家赢!"
)
elif
name
==
"石头"
and
ai
==
"剪刀"
:
print
(
"玩家赢!"
)
else
name
==
"石头"
and
ai
==
"布"
:
print
(
"人机赢!"
)
elif
name
==
"剪刀"
and
ai
==
"布"
:
print
(
"玩家赢!"
)
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