Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Administrator
/
level3-lesson16-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
a3a98320
authored
Mar 18, 2023
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
save project
parent
9e040108
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
6 deletions
binary_search.py
binary_search.py
View file @
a3a98320
...
...
@@ -3,12 +3,14 @@ num_list = [1, 3, 5, 8, 11, 15, 17, 18, 20, 21]
num
=
17
low
=
0
high
=
len
(
num_list
)
-
1
mid
=
(
low
+
higt
)
//
2
guess
=
num_list
[
mid
]
if
num
==
guess
:
print
(
"曹尼玛"
)
elif
guess
<
num
:
while
low
<=
high
:
mid
=
(
low
+
high
)
//
2
guess
=
num_list
[
mid
]
if
num
==
guess
:
print
(
"李宣邑别奖励自己了,你的困八都弯了"
,
mid
)
break0
elif
guess
<
num
:
low
=
mid
+
1
else
:
else
:
high
=
mid
-
1
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