Boredless Tourist Project

My code doesn’t work–I get a “list index out of range” error, even though my code is exactly the same as the one in the walkthrough video! What am I missing!

Is that all your code? Also, is it ok if you just copy/paste your code so we can put it into an editor and check it over there?

This is all of my code:

destinations = [‘Paris, France’, ‘Shanghai, China’, ‘Los Angeles, USA’, ‘So 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)
#print(test_destination_index)

attractions = [ for destination in destinations]
#print(attractions)
def add_attraction(destination, attraction):
try:
destination_index = get_destination_index(destination)
attractions_for_destination = attractions[destination_index]
attractions_for_destination.append(attraction)
except ValueError:
return

add_attraction(‘Los Angeles, USA’, [‘Venice Beach, [beach]’])
#print(attractions)
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(“So Paulo, Brazil”, [“So Paulo Zoo”, [“zoo”]])
add_attraction(“So Paulo, Brazil”, [“Ptio do Colgio”, [“historical site”]])
add_attraction(“Cairo, Egypt”, [“Pyramids of Giza”, [“monument”, “historical site”]])
add_attraction(“Cairo, Egypt”, [“Egyptian Museum”, [“museum”]])
#print(attractions)

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)

return attractions_with_interest

la_arts = find_attractions(“Los Angeles, USA”, [‘art’])
print(la_arts)

I went back to the point just before find_attractions(destination, interests) is defined, and everything works find up to that point. Then, I walked through all the steps to define the function, but when I run the code it gives me a “list index out of range error”. Even if I type exactly the code shown in the walkthrough video, I get the same error!

https://gist.github.com/9e941a1dc123a55cdf1690a1c5ad165f