curriculum/challenges/english/blocks/workshop-breadth-first-search/68da6138d70960c197ec5ef0.md
Now you'll implement the main BFS loop. Create a while loop that continues as long as the queue is not empty (while queue evaluates to True).
Inside the loop, print queue.
You should have a while loop in your gen_parentheses function.
({ test: () => runPython(`
assert _Node(_code).find_function("gen_parentheses").find_whiles()[0]
`) })
Your while loop should have the condition queue.
({ test: () => runPython(`
assert _Node(_code).find_function("gen_parentheses").find_whiles()[0].find_conditions()[0].is_equivalent("queue")
`) })
You should print queue inside your while loop.
({ test: () => runPython(`
assert _Node(_code).find_function("gen_parentheses").find_whiles()[0].find_bodies()[0].has_call("print(queue)")
`) })
--fcc-editable-region--
def gen_parentheses(pairs):
if not isinstance(pairs, int):
return 'The number of pairs should be an integer'
if pairs < 1:
return 'The number of pairs should be at least 1'
queue = [('', 0, 0)]
result = []
return result
--fcc-editable-region--