I’ve been trying to solve this one problem for about 2 hours now. I consistently keep getting a syntax error on line 44 (the very bottom) and have no idea why. The “attractions_in_city” variable to be precise. I’m sure the answer is staring me right in the face but I can’t for the life of me figure out what it is, my code looks just like the examples in the sidebar. Any help would be hugely appreciated, and apologies for the noob question!
destinations = ["Paris, France", "Shanghai, China", "Los Angeles, USA", "São 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:
attractions.append([])
def add_attraction(destination, attraction):
try:
destination_index = get_destination_index(destination)
attractions_for_destination = attractions[destination_index].append(attraction)
except SyntaxError:
return
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]