---
id: 683ec95f2f8781355556ff81
title: Step 9
challengeType: 20
dashedName: step-9
---

# --description--

You need to test out things so you will understand the flow of the algorithm at this initial stage.

To do that, you need to first break out of the loop. That's because the current implementation will only allow one iteration, so if the condition is not met, there will be an infinite loop.

Just after the `if`statement, use the `break` keyword to break out of the `while` loop. Then, after the `while` loop, return an empty list to signify that the value was not found.

# --hints--

You should use the `break` keyword to break out of the `while` loop after the `if` statement.

```js
({
    test: () => assert(runPython(
      `_Node(_code).find_function("binary_search").find_whiles()[0].find_body().has_stmt("break")`)
    )
})
```

You should return an empty list after your `while` loop.

```js
({
    test: () =>
      assert(
        runPython(
          `_Node(_code).find_function("binary_search").has_return("[]")`
        )
      )
})
```

# --seed--

## --seed-contents--

```py
def binary_search(search_list, value):
    path_to_target = []
    low = 0
    high = len(search_list) - 1
    
    while low <= high:
        mid = (low + high) // 2
        value_at_middle = search_list[mid]
        path_to_target.append(value_at_middle)
        
        if value == value_at_middle:
            return path_to_target
--fcc-editable-region--
        
--fcc-editable-region--
```
