Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
bellcode
/
lesson2-4-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
abb746ba
authored
Aug 16, 2020
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
save project
parent
443920d3
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
10 deletions
diy1.py
diy1.py
View file @
abb746ba
import
random
# 玩家出拳
player
=
input
(
"奥力给,干了兄弟们!:"
)
print
(
"
我:我出
"
+
player
)
player
=
input
(
"
机器人:
奥力给,干了兄弟们!:"
)
print
(
"
奥力给
"
+
player
)
#机器人出拳
robot
=
[
"石头"
,
"剪刀"
,
"布"
]
player2
=
random
.
choice
(
robot
)
print
(
"机器人:去死!"
+
player2
+
"吧"
)
if
player
==
player2
:
print
(
"机器人:平局"
)
elif
(
player
==
"布"
and
player2
==
"石头"
)
or
(
player
==
"石头"
and
player2
==
"剪刀"
)
or
(
player
==
"剪刀"
and
player2
==
"布"
)
print
(
"机器人:可恶"
)
else
:
print
(
"机器人:我赢了"
)
\ No newline at end of file
print
(
"机器人说:去死吧!"
+
player2
)
\ 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