The Boredless Tourist

Guys I am stuck here.This code is supposed to return attractions with a art but it is just returning .Please help me.
I have even watched the video and adjusted the code but don’t know what is wrong with it.

destinations=["Paris, France","Shanghai, China","Los Angeles, USA","Sao Paulo, Brazil","Cairo, Egypt"]

test_traveler=["Erin Wilkes", "Shanghai, China", ["historical site", "art"]]

def get_destination_index(destination):
  return destination_index

def get_traveler_location(traveler):
  return  traveler_destination_index


attractions=[ [] for d in destinations]

def add_attraction(destination,attraction):
  except ValueError:
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("Sao Paulo, Brazil", ["São Paulo Zoo", ["zoo"]])
add_attraction("Sao 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 attraction in attractions_in_city:
    possible_attraction = attraction
    attraction_tags = attraction[1]
    for interest in interests:
      if interest in attraction_tags:
  return attractions_with_interest

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


Presumably you meant to carry some series of actions to get that end result?

Rather than looking at the end result and stating that it’s wrong, maybe you’d look at the things you did before that and see if those individual things were successful?

Also, silently catching exceptions without handling them seems like a bad idea. If something bad happens you would want to know, not silently ignore it.

Every function before find_attractions() is performing what it ought to .find_attractions() isn’t giving proper result.

In instructions it was stated not to write anything in this block.

My ;logic for this function is correct and I even saw the project video and compared my code.But don’t know why it isn’t working properly.

Let’s say the rest is correct, that still leaves find_attractions itself, you’ve got a bunch of things happening there that you can look at the effects of rather than just the final outcome

You’re not going to do everything correctly and then end up with a wrong result. So there are earlier results that you can look at to get closer to the problem.

For example, are the inputs to your function correct? Is all the information needed to produce the correct result available? If not, then you would look at where you got those things from, or if those are okay, then you’d look at what you do with them.

Take ownership and control of the code! It’s not: I copied everything and the result is wrong.
You can print out lots of message explaining step by step what is being done, or print out only the things you specifically want to know about.

I am going to work on this function again.I hope that it will work.Will get back to you tomorrow if it doesn’t work again.