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
4dfb9a9f
authored
Mar 13, 2021
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
save project
parent
8aead555
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
14 deletions
diy1.py
diy1.py
View file @
4dfb9a9f
import
random
import
random
num
=
0
num
=
0
while
num
<
4
:
while
num
<
3
:
a
=
input
(
"我出拳是: "
)
a
=
input
(
"我出拳是: "
)
gn
=
[
"石头"
,
"剪刀"
,
"布"
]
gn
=
[
"石头"
,
"剪刀"
,
"布"
]
print
(
"出的拳是:"
+
a
)
print
(
"出的拳是:"
+
a
)
b
=
random
.
choice
(
gn
)
b
=
random
.
choice
(
gn
)
print
(
"计算机出拳: "
+
b
)
print
(
"计算机出拳: "
+
b
)
if
a
in
gn
:
if
a
in
gn
:
if
a
==
b
:
if
a
==
b
:
print
(
"平局"
)
print
(
"平局"
)
elif
(
a
==
"石头"
and
b
==
"剪刀"
)
or
(
a
==
"剪刀"
and
b
==
"布"
)
or
(
a
==
"布"
and
b
==
"石头"
):
elif
(
a
==
"石头"
and
b
==
"剪刀"
)
or
(
a
==
"剪刀"
and
b
==
"布"
)
or
(
a
==
"布"
and
b
==
"石头"
):
print
(
"我赢了"
)
print
(
"我赢了"
)
num
=
num
+
1
else
:
print
(
"计算机赢了"
)
else
:
else
:
print
(
"计算机赢了"
)
print
(
"输入错误"
)
else
:
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