I’m wondering if there’s an error in the test.
The instruction reads:
concatenate Given a series of lists, combine all items in all lists into one flattened list.
[[, ], [], [], [[4, 5, 6]]] my code returns
[1, 2, 3, 4, 5, 6] which I understand to be one flattened list.
However, looking at the test:
def test_concat_list_of_nested_lists(self): self.assertEqual( concat([[, ], [], [], [[4, 5, 6]]]), [, , , , [4, 5, 6]], )
…it appears that the output is supposed to be a list of lists. Plus I’m not sure if the comma in front of the last parenthesis is intentional?
def concat(lists): result =  for item in lists: if isinstance(item, list): result.extend(concat(item)) else: result.append(item) return result
Thanks much for guidance on this.