Extend a Path by One Choice
Practise choose, record a copy, and un-choose on one level of a backtracking search.
The problem
Implement expand_backtracking_frame(path, choices). path is the list of choices made so far, and choices lists the options for the next position. Return a list with one new list per choice: the items of path followed by that choice, in the same order as choices. Every returned list must be a separate list, repeated choices give repeated results, and when the function returns, path and choices must hold exactly what they held before.
Starter code
def expand_backtracking_frame(path, choices):
passPublic examples
path = [1], choices = ["a", "b", "c"]gives[[1, "a"], [1, "b"], [1, "c"]]path = [], choices = [2, 3]gives[[2], [3]]
Solving it in the practice book needs an active paid plan.
Open it in the practice bookOne thought at a time.
