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
53cccfe5
authored
Mar 21, 2021
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
auto save
parent
c26b0548
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
34 additions
and
6 deletions
diy1.py
diy1.py
View file @
53cccfe5
print
(
"您收到了一个微信信息:石头剪刀布2021人机总决赛就要开始,请问您要参加吗?"
)
input
(
"网站:请问您要参加吗?"
)
yourchoice
=
input
if
yourchoice
==
"是"
or
"Yes"
:
print
(
"欢迎来到石头剪刀布Windows10版本"
)
# 玩家出拳
playerchoice
=
input
(
"剪刀,石头,布,你出哪个???"
)
print
(
"玩家出拳:"
+
playerchoice
)
playerchoice
=
input
(
"剪刀,石头,布,你出哪个???"
)
print
(
"玩家出拳:"
+
playerchoice
)
#电脑随机出拳
import
random
list
=
[
"剪刀"
,
"石头"
,
"布"
]
computerchoice
=
random
.
choice
(
list
)
print
(
"电脑出拳:"
+
computerchoice
)
import
random
list
=
[
"剪刀"
,
"石头"
,
"布"
]
computerchoice
=
random
.
choice
(
list
)
print
(
"电脑出拳:"
+
computerchoice
)
if
playerchoice
==
computerchoice
:
print
(
"系统提示:本局为平局"
)
elif
(
playerchoice
==
"剪刀"
and
computerchoice
==
"布"
)
or
(
playerchoice
==
"石头"
and
computerchoice
==
"剪刀"
)
or
(
playerchoice
==
"布"
and
computerchoice
==
"石头"
):
print
(
"系统提示:玩家获胜"
)
else
:
print
(
"系统提示:电脑获胜"
)
if
yourchoice
==
"不"
or
"No"
:
print
(
"欢迎来到石头剪刀布Windows10版本"
)
# 玩家出拳
playerchoice
=
input
(
"剪刀,石头,布,你出哪个???"
)
print
(
"玩家出拳:"
+
playerchoice
)
#电脑随机出拳
import
random
list
=
[
"剪刀"
,
"石头"
,
"布"
]
computerchoice
=
random
.
choice
(
list
)
print
(
"电脑出拳:"
+
computerchoice
)
if
playerchoice
==
computerchoice
:
print
(
"系统提示:本局为平局"
)
elif
(
playerchoice
==
"剪刀"
and
computerchoice
==
"布"
)
or
(
playerchoice
==
"石头"
and
computerchoice
==
"剪刀"
)
or
(
playerchoice
==
"布"
and
computerchoice
==
"石头"
):
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