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
a4945d09
authored
Oct 18, 2020
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
auto save
parent
23dfff73
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
0 deletions
1.py
1.py
0 → 100644
View file @
a4945d09
import
random
#导入random模块
#玩家出拳
player
=
input
(
"请出拳(剪刀/石头/布):"
)
#使用input()函数读入玩家出拳并赋值给player
print
(
"玩家出拳:"
+
player
)
#输出玩家从屏幕输入的内容
#计算机出拳
list1
=
[
"剪刀"
,
"石头"
,
"布"
]
#新建出拳类型的列表
computer
=
random
.
choice
(
list1
)
#随机在列表中选择出拳内容并赋值给computer变量
print
(
"计算机出拳:"
+
computer
)
#输出计算机出拳的内容
\ 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