The Boredless Tourist Help

Cannot figure out why the tags still show in the terminal. I’ve tried unindenting the append line since mine looks more indented than the one in the help vid but this just creates an ‘expected an indentation error’. Not sure what the issue is.

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 = attraction[1]

    

    for interest in interests:

      if interest in attraction_tags:

        attractions_with_interest.append(possible_attraction[0])

  return attractions_with_interest

la_arts = find_attractions(("Los Angeles,USA"), ["art"])

print(la_arts)

I believe that you need to change the line:

possible_attraction = [attraction]

to:

possible_attraction = attraction

That is the only difference I could find between the portion of the project you included and my own.

You want to pull one item at a time from the list, not create a new list containing each individual item. Someone else may be able to explain it a bit better, as I am quite new(b) myself.

Hope it helps a bit though!

Kind Regards :slight_smile:

This fixed it.

Thank You :slight_smile:

1 Like

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.