Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
bellcode
/
lesson2-1-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
97e0eae9
authored
Sep 20, 2021
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
auto save
parent
f6c520a1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
52 additions
and
2 deletions
diy1.py
ooo.py
diy1.py
View file @
97e0eae9
# 我们都爱夸夸夸
\ No newline at end of file
# 剪刀石头布
import
random
ch
=
input
(
"请输入剪刀石头布"
)
renji
=
random
.
randint
(
1
,
3
)
if
renji
==
1
:
renji
=
"剪刀"
if
renji
==
2
:
renji
=
"石头"
if
renji
==
3
:
renji
=
"布"
print
(
"您出的是"
+
ch
)
print
(
"人机出的是"
+
renji
)
if
ch
==
renji
:
print
(
"平局"
)
if
(
ch
==
"布"
and
renji
==
"石头"
)
or
(
ch
==
"剪刀"
and
renji
==
"布"
)
or
(
ch
==
"石头"
and
renji
==
"剪刀"
):
print
(
"获胜"
)
else
:
print
(
"失败"
)
# if ch=="剪刀":
# if renji=="剪刀":
# print("平局")
# if renji=="石头":
# print("失败")
# if renji=="布":
# print("获胜")
# if ch=="石头":
# if renji=="剪刀":
# print("获胜")
# if renji=="石头":
# print("平局")
# if renji=="布":
# print("失败")
# if ch=="布":
# if renji=="剪刀":
# print("失败")
# if renji=="石头":
# print("获胜")
# if renji=="布":
# print("平局")
\ No newline at end of file
ooo.py
0 → 100644
View file @
97e0eae9
import
random
list
=
[
"剪刀"
,
"石头"
,
"布"
]
玩家出拳
=
input
(
"请输入,你的猜拳"
)
电脑出拳
=
random
.
choice
(
list
)
print
(
"玩家出拳是:"
+
玩家出拳
)
print
(
"电脑出拳是:"
+
电脑出拳
)
if
玩家出拳
==
电脑出拳
:
print
(
"平局"
)
if
(
玩家出拳
==
"布"
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