curriculum/challenges/english/blocks/workshop-binary-search/683ec95f2f8781355556ff7b.md
In binary search, there is the lowest possible index and the highest possible index.
The lowest possible index represents the leftmost boundary in the current portion of the values being searched within, in this case, search_list. The highest possible index, on the other hand, represents the rightmost boundary in the values being searched.
To account for those two, you have to consider the entire list being searched. So, inside the binary_search function, define a low variable with a value of 0, and a high variable with a value that accounts for the last index in the list being searched.
You should have a variable named low in your binary_search function.
({
test: () => assert(runPython(`_Node(_code).find_function("binary_search").has_variable("low")`))
})
Your low variable should be set to 0.
({
test: () =>
assert(
runPython(
`_Node(_code).find_function("binary_search").find_variable("low").is_equivalent("low = 0")`
)
)
})
You should have a variable named high in your binary_search function.
({
test: () => assert(runPython(`_Node(_code).find_function("binary_search").has_variable("high")`))
})
Your high variable should be set to len(search_list) - 1.
({
test: () => assert(
runPython(
`_Node(_code).find_function("binary_search").find_variable("high").is_equivalent("high = len(search_list) - 1")`
))
})
--fcc-editable-region--
def binary_search(search_list, value):
path_to_target = []
--fcc-editable-region--