Tell us what’s happening:
i am being told to use the ternary syntax to assign [target] when target is truthy and graph otherwise. however, there is an error saying that target is not defined
Your code so far
targets_to_print = [target] if target else graph
shortest_path(my_graph, 'A')
# User Editable Region
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36 Edg/131.0.0.0
Challenge Information:
Learn Algorithm Design by Building a Shortest Path Algorithm - Step 54