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
You need to sign in or sign up before continuing.
Commit
57522ef8
authored
Mar 23, 2026
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
save project
parent
c90bc830
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
35 additions
and
3 deletions
diy1.py
diy1.py
View file @
57522ef8
neme
=
input
(
"What's your name?"
)
import
random
print
(
"Hello,"
+
neme
+
"!"
)
small_num
=
0
\ No newline at end of file
big_num
=
100
boom
=
random
.
randint
(
0
,
100
)
while
True
:
answer
=
input
(
"在"
+
str
(
small_num
)
+
"到"
+
str
(
big_num
)
+
"选择一个数。"
)
if
answer
.
isdigit
():
answer
=
int
(
answer
)
if
answer
>=
big_num
or
answer
<=
small_num
:
if
answer
>=
big_num
:
if
answer
>
big_num
:
print
(
"你说的数比最大数大了,再说一次吧!"
)
continue
else
:
print
(
"你说的数和最大数一样了,再说一次吧!"
)
continue
else
:
if
answer
<
small_num
:
print
(
"你说的数比最小数小了,再说一次吧!"
)
continue
else
:
print
(
"你说的数和最小数一样了,再说一次吧!"
)
continue
elif
answer
==
boom
:
print
(
"boom!炸弹爆炸了!炸弹数字是:"
+
str
(
boom
))
eixt
()
elif
answer
>
boom
:
print
(
"这个数字不是炸弹哦,继续吧!"
)
big_num
=
answer
else
:
print
(
"这个数字不是炸弹哦,继续吧!"
)
small_num
=
answer
else
:
print
(
"你输入的不是数字哦,重输一次吧!"
)
\ 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