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
d1e132ce
authored
Mar 26, 2023
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
auto save
parent
23dfff73
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
0 deletions
diy3.py
diy3.py
0 → 100644
View file @
d1e132ce
#导入模块
import
random
#创建列表
list
=
[
"石头"
,
"剪刀"
,
"布"
]
# 让玩家选择出拳
player
=
input
(
"请出拳:石头/剪刀/布"
)
#打印玩家出拳
print
(
"玩家出拳:"
+
player
)
#使用chioce方法随机抽取
computer
=
random
.
choice
(
list
)
#打印结果
print
(
"计算机出拳:"
+
computer
)
#判断结果
if
player
==
computer
:
print
(
"平局"
)
elif
(
player
==
"剪刀"
and
computer
==
"布"
)
or
(
?
and
?
)
or
(
?
and
?
)
:
print
(
"恭喜你赢了"
)
elif
(
?
and
?
)
or
(
?
and
?
)
or
(
?
and
?
):
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