--- id: 6557743527cb92a06417ea97 title: الخطوة 21 challengeType: 20 dashedName: step-21 --- # --description-- Create a `for` loop to iterate over your graph, and append each node to the `unvisited` list. # --hints-- You should create a `for` loop to iterate over `graph` inside the `shortest_path` function. ```js ({ test: () => { const shortest = __helpers.python.getDef(code, "shortest_path"); const {function_body} = shortest; assert(function_body.match(/^(\s*)for\s+(\w+)\s+in\s+graph\s*:/m)); } }) ``` You should append each node to `unvisited` inside your `for` loop. ```js ({ test: () => { const shortest = __helpers.python.getDef(code, "shortest_path"); const {function_body} = shortest; assert(function_body.match(/^(\s*)for\s+(\w+)\s+in\s+graph\s*:\s*^\1\1unvisited\.append\s*\(\s*\2\s*\)/m)); } }) ``` # --seed-- ## --seed-contents-- ```py my_graph = { 'A': [('B', 3), ('D', 1)], 'B': [('A', 3), ('C', 4)], 'C': [('B', 4), ('D', 7)], 'D': [('A', 1), ('C', 7)] } --fcc-editable-region-- def shortest_path(graph, start): unvisited = [] --fcc-editable-region-- ```