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
6cd2dbff
authored
Aug 06, 2023
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
save project
parent
16f7b04a
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
7 deletions
diy1.py
diy1.py
View file @
6cd2dbff
import
random
import
random
piayer
=
input
(
"请出拳(石头、剪刀、布):"
)
piayer
=
input
(
"请出拳(石头、剪刀、布):"
)
print
(
"玩家出拳:"
+
piayer
)
print
(
"玩家出拳:"
+
piayer
)
li
ts
=
[
"石头"
,
"剪刀"
,
"布"
]
li
st
=
[
"石头"
,
"剪刀"
,
"布"
]
NPC
=
random
.
choice
(
li
ts
)
NPC
=
random
.
choice
(
li
st
)
print
(
"计算机出拳:"
+
NPC
)
print
(
"计算机出拳:"
+
NPC
)
if
piayer
==
NPC
:
if
piayer
in
list
:
if
piayer
==
NPC
:
print
(
"平局"
)
print
(
"平局"
)
elif
piayer
==
"石头"
and
NPC
==
"剪刀"
:
elif
piayer
==
"石头"
and
NPC
==
"剪刀"
:
print
(
"玩家获胜"
)
print
(
"玩家获胜"
)
elif
piayer
==
"剪刀"
and
NPC
==
"布"
:
elif
piayer
==
"剪刀"
and
NPC
==
"布"
:
print
(
"玩家获胜"
)
print
(
"玩家获胜"
)
elif
piayer
==
"布"
and
NPC
==
"石头"
:
elif
piayer
==
"布"
and
NPC
==
"石头"
:
print
(
"玩家获胜"
)
print
(
"玩家获胜"
)
else
:
else
:
print
(
"计算机获胜"
)
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