Need help with my code,

Hi guys!
I’m a little stuck here, and would appreciate some help.

I’ve been doing this project, and it was going fine , till the last response was wrong.

it’s meant to return “Hi Dereck Smill, we think you’ll like these places around Paris, France: the Arc de Triomphe”
but returns Hi Dereck Smill, we think you’ll like these places around Paris, France:.

I’ve been trying to fix this, but no clues. anyone have any ideas on what am I doing wrong?

  • The traveler’s interests (whether single interest or multiple interests) are expected to be passed as a list.
    ["monument"] instead of "monument"
# You wrote:
print(get_attractions_for_traveler(['Dereck Smill', 'Paris, France', 'monument']))

# It should be:
print(get_attractions_for_traveler(['Dereck Smill', 'Paris, France', ['monument']]))

In your code, you made a correct function call earlier,

la_arts = find_attractions("Los Angeles, USA",['art'])

To see what happens when you pass the interests as a string (as opposed to a list), then in the find_attractions function, add a print statement for debugging. It will show you iterating over the characters of a string as opposed to the desired behavior of iterating over the strings in a list.

for interest in interests :
      print(interest)  # <--- For debugging
      if interest in attraction_tags :
        attractions_with_interest.append(possible_attraction[0])
3 Likes

if code was shootable, I’d have definitely shot it now…
thanks for letting me know , and happy coding!<3