I’m having issues with adding a list to a sublist here. I thought I would use the append option but the hint says otherwise. Here’s the logic I built out so far, but I feel like it’s wrong. Also, is there anyway I can test this to see if it’s correct before I move on?
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")) def get_traveler_location(traveler): traveler_destination = test_traveler 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 x in destinations] print(attractions) def add_attraction(destination, attraction): destination_index = get_destination_index.index(destination) try: destination_index = None except ValueError: return attractions_for_destination = attractions[attraction]