The Boredless Tourist ValueError

Hello all,

I am current doing the Boredless Tourist Project and am stuck on step 50. I keep getting this error but I don’t know what I’m doing wrong.

Traceback (most recent call last):
File “script.py”, line 43, in
add_attraction(“São Paulo, Brazil”, [“São Paulo Zoo”, [“zoo”]])
File “script.py”, line 28, in add_attraction
get_destination = get_destination_index(destination)
File “script.py”, line 5, in get_destination_index
destination_index = destinations.index(destination)
ValueError: ‘São Paulo, Brazil’ is not in list

Thanks in advance!

Could you please attach a link to the exercises as well as screenshot of your code. From that I will be able to know more about the error that occurs.

1 Like

Yes, of course:

Project Link

destinations = [“Paris, France”, “Shanghai, China”,“Los Angeles, USA”, “Sao Paulo, Brazil”, “Cairo, Egypt”]
test_traveler = [‘Erin Wilkes’, ‘Shanghai, China’, [‘historical site’, ‘art’]]
#8, 9, 10
def get_destination_index(destination):
destination_index = destinations.index(destination)
return destination_index
#11
#print(get_destination_index(“Los Angeles, USA”))
#12
#print(get_destination_index(“Paris, France”))
#13, 14
#print(get_destination_index(“Hydrabad, India”))
#15, 16, 17, 18
def get_traveler_locations(traveler):
traveler_destination = traveler[1]
traveler_destination_index = get_destination_index(traveler_destination)
return traveler_destination_index
#19
test_destination_index = get_traveler_locations(test_traveler)
#20
print(test_destination_index)
#25, 25
attractions = [ for destination in destinations]
#26
print(attractions)
#27, 31, 32
def add_attraction(destination, attraction):
get_destination = get_destination_index(destination)
destination_index = destinations.index(destination)
attractions_for_destination = attractions[destination_index].append(destination)
return
#33
add_attraction(“Los Angeles, USA”, [‘Venice Beach’, [‘beach’]])
#34
print(attractions)
#36
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”, “historical 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”]])
#38,39,40,41,42,43,44, 45, 46
def find_attractions(destination, interests):
get_destination = get_destination_index(destination)
attractions_in_city = attractions[destination_index]
attractions_with_interest =

for attraction in attractioms_with_interest:
possible_attraction = attraction
attraction_tags = attraction[1]

for interest in interests:
  if interest in attraction_tags:
    attractions_with_interest.append(possible_attraction)

return attractions_with_interests
#47
la_arts = find_attractions(“Los Angeles, USA”, [‘art’])
#48
print(la_arts)

Thanks for providing me with more information, I may be wrong with my solution, and someone please correct me if I am. but i believe this ties down to a simple spelling error.

[quote=“byte5075324320, post:1, topic:728894”]
ValueError: ‘São Paulo, Brazil’ is not in list

remove the * [ã] - minuscule, with tilde an simply replace it with a normal [a].

keep in mind that this code means that your item in your list does not exist when this error pops up and you are sure you wrote it, then check the for the spelling, punctuation, etc
remember coding in general is literally literal.

3 Likes

Please let me know if you still get any errors lets solve this problem together

1 Like

Yes, this worked! thank you!

2 Likes