September 1, 2020, 7:43am
in the boredless tourist project task 34, when i try printing “add_attraction”, it shows me this
“<function add_attraction at 0x7f8843cc8950>”
instead of printing out the list.
here is my function:
def add_attraction(destination, attraction):
destination_index = get_destination_index(destination)
attractions_for_destination = attractions[destination_index].append(attraction)
add_attraction("Los Angeles, USA", ['Venice Beach', ['beach']])
i can’t find the bug in the code.
and thanks in advance!
That could be because you are printing it without the parentheses on the function call:
This will print information about the function
add_attraction, such as its type (function), its name, and where it is stored in memory. If you print it with parentheses:
It should work.
I hope this helps!
September 1, 2020, 11:15am
It’s also worth noting that the way it is written, that function has only side effects (altering the
attractions_for_destination list) and doesn’t ->
return <- anything to the caller. Even if you printed its
return after passing the correct arguments you still wouldn’t get a value. Is that intentional?