Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
binary_search
def bin_search(list, item): low = 0 high = len(list) - 1 print(high) while low <= high: mid = (low + high) // 2 guess = list[mid] if guess == item: return mid if guess > item: high = mid - 1 else: low = mid + 1 return None my_list = [1, 3, 5, 7, 9] d = int (input('Введите число:')) print( bin_search(my_list, d))
run
|
edit
|
history
|
help
0
gfg pattern
crown pattern
Python 3: Queue
My name
isStrong.py
(P3) Rok przestępny
Q5
PyTempConvDIP
reverse the number
Hello,world