Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
bellcode
/
lesson2-3-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
2e9cb032
authored
3 years ago
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
save project
parent
5117dfc8
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
32 additions
and
2 deletions
diy1.py
diy1.py
View file @
2e9cb032
import
random
# 玩家出拳
a
=
input
(
"你出啥?石/剪/布:"
)
while
not
(
a
in
[
"石"
,
"剪"
,
"布"
]):
a
=
input
(
"你出啥?石/剪/布:"
)
print
(
"玩家出的是----"
+
a
)
#电脑出拳
d
=
random
.
choice
([
"石"
,
"剪"
,
"布"
])
print
(
"电脑出的是----"
+
d
)
\ No newline at end of file
print
(
"电脑出的是----"
+
d
)
if
a
==
"布"
:
if
d
==
"布"
:
print
(
"平局!"
)
elif
d
==
"剪"
:
print
(
"输了!"
)
elif
d
==
"石"
:
print
(
"赢了!"
)
if
a
==
"剪"
:
if
d
==
"布"
:
print
(
"赢了!"
)
elif
d
==
"剪"
:
print
(
"平局!"
)
elif
d
==
"石"
:
print
(
"输了!"
)
if
a
==
"石"
:
if
d
==
"布"
:
print
(
"输了!"
)
elif
d
==
"剪"
:
print
(
"赢了!"
)
elif
d
==
"石"
:
print
(
"平局!"
)
input
()
\ No newline at end of file
This diff is collapsed.
Click to expand it.
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