The Boredless Tourist

I am having trouble with the Boredless Tourist Project. Here is the code I have so far:

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): ind = destinations.index(destination) return ind print(get_destination_index("Los Angeles, USA")) print(get_destination_index("Paris, France")) # print(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 test_destination_index = get_traveler_location(test_traveler) print(test_destination_index) attractions = [[] for destination in destinations] print (attractions) def add_attraction(destination, attraction): destination_index = get_destination_index(destination) attractions_for_destination = attractions[destination_index].append(attraction) return add_attraction("Los Angeles, USA", ['Venice Beach', ['beach']]) print(attractions)

I am trying my best to complete it, but every time I call the script I end up with an empty list of attractions when the instructions say I should expect at least one of the attractions to have my inputted variable when I call add attraction. If someone understands what’s going on here, I would greatly appreciate the help.

Indentation is very important in Python.

Look at the indentation of your last two statements,

def add_attraction(...):
    ...
    return      
    
    add_attraction("Los Angeles, USA", ['Venice Beach', ['beach']])

    print(attractions)

It should be:

def add_attraction(...):
    ...
    return      
    
add_attraction("Los Angeles, USA", ['Venice Beach', ['beach']])

print(attractions)

Thank you. That fixed the problems with my code.