Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
bellcode
/
lesson2-1-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
78aaf602
authored
Feb 25, 2024
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
save project
parent
b0871040
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
21 deletions
x.py
x.py
View file @
78aaf602
import
random
def
new_input
():
Ansser
=
[
"stong"
,
"sizzer"
,
"paper"
]
total
=
[]
#player
while
True
:
player_ansser
=
input
(
"player's:(stong/sizzer/paper)"
)
unit
=
input
(
"jiage:"
)
if
unit
==
'q'
:
#computer
break
computer_ansser
=
random
.
choice
(
Ansser
)
else
:
print
(
"computer's:"
+
computer_ansser
)
try
:
#compare
unit
=
int
(
unit
)
if
computer_ansser
==
"stong"
and
player_ansser
==
"paper"
:
except
:
print
(
"You win!"
)
print
(
"要输入int"
)
elif
computer_ansser
==
"sizzer"
and
player_ansser
==
"stong"
:
else
:
print
(
"You win!"
)
total
.
append
(
unit
)
elif
computer_ansser
==
"paper"
and
player_ansser
==
"sizzer"
:
print
(
'结束'
)
print
(
"You win!"
)
print
(
total
)
elif
computer_ansser
==
player_ansser
:
new_input
()
print
(
"We're all win!"
)
\ No newline at end of file
else
:
print
(
"You lose."
)
\ 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