The Boredless tourist

Hy guys, I am getting an error and I don’t really understand why. I checked my code several times and still it is not working.
Here it is:

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): destination_index = destinations.index(destination) return(destination_index) #print(get_destination_index("Los Angeles, USA")) #get_destination_index("Hyderabad, India") def get_traveler_location(traveler): traveler_destination = traveler[1] traveler_destination_index = get_destination_index(traveler_destination) return(traveler_destination_index) attractions = [[] for attraction in destinations] #print(attractions) def add_attraction(destination, attraction): destination_index = get_destination_index(destination) try: destination_index = get_destination_index(destination) attractions_for_destination = attractions[destination_index] attractions_for_destination.append(attraction) except SyntaxError: return attractions_for_destination = attractions[destination_index] test_destination_index = get_traveler_location(test_traveler) 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 attr_in_city in attractions_in_city: possible_attraction = attr_in_city attraction_tags = attr_in_city[1] for interest in interests: if interest in attraction_tags: attractions_with_interest.append(possible_attraction[0]) return(attractions_with_interest)

I am getting this error

I am in the verge of punching walls and pulling my hair out hahaha

It takes a little getting used to and perhaps some background reading but understanding Python’s trackbacks is a very useful skill to learn. The basic traceback sent to stdout is kept quite short but is designed to let you to locate where the exception was raised in terms of the call stack.

As the head of the trackback mentions, we see the most recent call (function/method call) last. So we see that a line destinations.index( destination) in get_destination_index has thrown an ValueError. You could look at the rest of the traceback so see where the call originated from but here that issue alone is telling (especially with the message).

An attempt to .index the list destinations has failed because that list does not have an element 'São Paulo, Brazil'. Double check the first line of your codebyte where you create your destinations list. Is ‘São Paulo, Brazil’ in this list, or is there something else?