Learn Algorithm Design by Building a Shortest Path Algorithm - Step 54

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

you are writing this in the global scope, remember indentation! you need to indent the code so that it is inside what it needs to be inside

Thank you!! I knew it would be something silly as well :man_facepalming: