Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
bellcode
/
lesson2-5_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
999dd6f5
authored
Jun 18, 2023
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
save project
parent
4b88bdae
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
7 deletions
666.py
diy1.py
666.py
0 → 100644
View file @
999dd6f5
'''
result = input("请输入整数:")
if result.isdigit():
user_num = int(result)
result_num = 88
if user_num == result_num:
print("bingo")
else:
print("wrong")
else:
print("不是整数")
'''
result_num
=
88
def
getResult
():
result
=
input
(
"请输入整数:"
)
if
result
.
isdigit
():
guess
(
int
(
result
))
else
:
print
(
"不是整数"
)
getResult
()
def
guess
(
user_num
):
if
user_num
==
result_num
:
print
(
"bingo"
)
else
:
print
(
"wrong"
)
getResult
()
getResult
()
\ No newline at end of file
diy1.py
View file @
999dd6f5
player
=
input
(
"请出拳:石头/剪刀/布"
)
# 玩家出拳
print
(
"玩家出拳:"
+
player
)
import
random
a
=
[
"石头"
,
"剪刀"
,
"布"
]
c
=
computer
=
random
.
choices
(
a
)
print
(
c
)
\ No newline at end of file
str
.
isdigit
(
''
)
\ 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