Hi there,
I finished the Borderless Tourist, and it works! However, I’m not 100% confident I understand how this function is working. The purpose of it, is to take in a destination and an attraction and add that attraction to the attractions list in the right index, per the destination:
def add_attraction(destination, attraction):
try:
destination_index = get_destination_index(destination)
attractions_for_destination = attractions[destination_index]
attractions_for_destination.append(attraction)
return
except ValueError: print("Destination doesn't exist!")
return
- destination_index takes destination as an argument and returns that destinations index in the attractions list–which has an index of 0-4, in which I store destinations per city.
- attractions_for_destination takes the destinations stored in the attractions list, at the index that was retrieved
- I then append the attraction that is passed to this add_attraction function to the attractions_for_destination variable, and return.
At what point does the attraction/destination combo get stored into the attractions list?