Tell us what’s happening:
I can’t tell what’s wrong with my code for this step. I added debugging steps that show the tuple was correctly unpacked. What am I missing?
Your code so far
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 = []
# User Editable Region
while queue:
print(queue)
tup = queue.pop(0)
current, opens_used, closes_used = tup
result.append(current)
result.append(opens_used)
result.append(closes_used)
# User Editable Region
return result
print(gen_parentheses(2))
Your browser information:
User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.1 Safari/605.1.15 Ddg/26.1
Challenge Information:
Implement the Breadth-First Search Algorithm - Step 7