Copy a list
list(path) or path[:] both create a copy of the path. Useful in backtracking problems: appending path itself stores a reference, so later changes to path would change the saved answer too.
| 1 | result.append(path[:]) # or: result.append(list(path)) |