I’ve been attempting to complete this project. I don’t understand the logic behind the function
add_attraction(). Inside the function, we need to make a variable
attractions_for_destination, append the value passed by
attraction variable, and return nothing?
by that logic,
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: return
if I do this, because there is nothing that modifies attractions variable, every time
attractions_for_destination = attractions[destination_index] is run, it will assign an empty list, I think? I honestly don’t understand the logic. why not append the attraction directly to the attractions list, like
attractions[destination_index].append(attraction), instead of creating a variable
PS: How do I properly add indentation? my whitespace is eaten.