The Boredless Tourist Project

I’m not sure what this for loop does. I watched the walkthrough video but I don’t understand. This loop just keeps setting possible_attraction equal to a in attractions_in_city right? So what is the point? Once the loop has finished wouldn’t possible_attraction just be equal to the final a in attractions_in_city? I’m very confused.

for a in attractions_in_city:
possible_attraction = a
attraction_tags = a[1]

Here is the github link since I’m not sure how to format code in this text box. Thanks in advance.

destinations = [“Paris, France”, “Shanghai, China”, “Los Angeles, USA”, “São Paulo, Brazil”, “Cairo, Egypt”]
test_traveler = [‘Erin Wilkes’, ‘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
test_destination_index = get_traveler_location(test_traveler)

attractions =
for d in destinations:

def add_attraction(destination, attraction):
destination_index = get_destination_index(destination)
except SyntaxError:
attractions_for_destination = attractions[destination_index]

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”, “historcical 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(“São Paulo, Brazil”, [“São Paulo Zoo”, [“zoo”]])
add_attraction(“São Paulo, Brazil”, [“Pátio do Colégio”, [“historical site”]])
add_attraction(“Cairo, Egypt”, [“Pyramids of Giza”, [“monument”, “historical site”]])
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 a in attractions_in_city:
possible_attraction = a
attraction_tags = a[1]

for interest in interests:
if interest == a:
if interest in attraction_tags:

Hi @arc9085533972,

You can see the following FAQ for details on formatting code but for longer files something like github is the right way to go. It would also be worthwhile linking to the lesson you’re working on so others can quickly see the context.

In reference to your first loop you seem right about possible attraction. Is the main point to get attraction_tags perhaps? Or have you missed some sort of nesting of those loops. At present I can’t see what the purpose of that loop (though I’ve not read every line) and I’m expecting there to be more to it. Check indentation very carefully and if you get it make sure you understand why it was used. Would you do it the same way? Copying code always carries risks like this and you should aim to understand the entire thing.

I think I figured it out. Usually the video walkthrough explains why/what they are doing. But this walkthrough was not helpful.