FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
python-3/exercises/binary-search/example.py at master · MaxCodeXTC/python-3 · GitHub
MaxCodeXTC
python-3
Repository navigation
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
python-3
/
exercises
/
binary-search
/
example.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
12 lines (12 loc) · 354 Bytes
Breadcrumbs
python-3
/
exercises
/
binary-search
/
example.py
Copy path
File metadata and controls
12 lines (12 loc) · 354 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
def
find
(
search_list
,
value
):
low
=
0
high
=
len
(
search_list
)
-
1
while
low
<=
high
:
middle
=
(
low
+
high
)
//
2
if
search_list
[
middle
]
>
value
:
high
=
middle
-
1
elif
search_list
[
middle
]
<
value
:
low
=
middle
+
1
else
:
return
middle
raise
ValueError
(
"Value not found."
)
Back
|
FazBrowse Home
|
New Git URL