Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
bellcode
/
lesson2-2_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
44289a7e
authored
Sep 24, 2021
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
auto save
parent
a0cbfb52
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
2 deletions
diy1.py
diy1.py
View file @
44289a7e
# 玩家出拳
# 玩家出拳
\ No newline at end of file
player
=
input
(
"请出拳(石头/剪刀/布):"
)
print
(
"玩家出:"
+
player
)
#计算机出拳
##0.导入模块 random
##1.首先,需要有出拳的类型。使用列表list存储出拳类型:石头、剪刀、布
##2.需要随机为计算机出一种拳。使用random模块
##3.查看计算机出的拳。使用打印函数print()
#显示结果
#1.平局:玩家和计算机出拳一样;
#2.玩家赢:玩家出剪刀,计算机出布;玩家出石头,计算机出剪刀;玩家出布,计算机出石头
#3.玩家输:玩家出布,计算机出剪刀;玩家出剪刀,计算机出石头;玩家出石头,计算机出布
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