The Boredless Tourist: Empty List Return, Bug?

Greetings Everyone,

Thank you all for the help and great insight ahead of time. I am currently working through “The Boredless Tourist” exercise in the computer science pathway. I am experiencing an unexpected result in the console and for the life of me cannot figure out what it is. I would love to see if anyone might know why the code is returning an empty list ( ). The expected return in the console should be ( [‘LACMA’, [‘art’, ‘museum’]] ). This is step #48 for reference. I’ve looked at the walkthrough video and matched the code verbatim from what I can cross reference. Additionally, I have done systematic print statements to make sure the variables are populating when they are going through the loop statements. I’m at a loss here.

Here is the link to the exercise:

Here is the code:

destinations = ["Paris, France", "Shanghai, China", "Los Angeles, USA", "Sao Paulo, Brazil", "Cairo, Egypt"] test_traveler = ["Erin Wilkens", "Shanghai, China", ["Historical site", "art"]] def get_destination_index(destination): destination_index = destinations.index(destination) return destination_index def get_traveler_location(traveler): traveler_destination = traveler[1] traveler_destination_index = get_destination_index(traveler_destination) return traveler_destination_index attractions = [] for destination in destinations: attractions.append([]) def add_attraction(destination, attraction): destination_index = get_destination_index(destination) attractions_for_destination = attractions[destination_index].append(attraction) return attractions add_attraction("Los Angeles, USA", ["Venice Beach", ["beach"]]) add_attraction("Paris, France", ["the Louvre", ["art", "museum"]]) add_attraction("Paris, France", ["Arc de Triomphe", ["historical site", "monument"]]) add_attraction("Shanghai, China", ["Yu Garden", ["garden", "histroical site"]]) add_attraction("Shanghai, China", ["Yuz Museum", ["art", "museum"]]) add_attraction("Shanghai, China", ["Oriental Pearl Tower", ["skyscraper", "viewing deck"]]) add_attraction("Los Angeles, USA", ["LACMA", ["art", "museum"]]) add_attraction("Sao Paulo, Brazil", ["Sao Paulo Zoo", ["zoo"]]) add_attraction("Sao Paulo, Brazil", ["Patio do Colegio", ["historical site"]]) add_attraction("Cairo, Egypt", ["Pyramids of Giza", ["monument", "historical sit"]]) add_attraction("Cairo, Egypt", ["Egyptian Museum", ["museum"]]) def find_attractions(destination, interests): destination_index = get_destination_index(destination) attractions_in_city = attractions[destination_index] attractions_with_interest = [] for attraction in attractions_in_city: possible_attraction = attraction attraction_tags = attractions[1] for interest in interests: if interest in attraction_tags: attractions_with_interest.append(possible_attraction) return attractions_with_interest la_arts = find_attractions("Los Angeles, USA", ["art"]) print(la_arts)

Thank you!

Taylor S.

In line 41 of the codeByte, you have an extra s

    attraction_tags = attractions[1]

but that should be

    attraction_tags = attraction[1]

@janbazant1107978602 Thank you so much! I now realize I was getting caught up in the temp var vs the list. Thank you, thank you, thank you!! You’re a lifesaver.