Boredless tourist help

Im doing the Boredless Tourist on Codeacademy and for some reason I can’t get # 20 right, here’s the code dunno why it comes as an error and won’t print. the last part is what I need, thanks.

destinations = [“Paris, France”, “Shangai, China”, “Los Angeles, USA”, “São Paulo, Brazil”, “Cairo, Egypt”]

test_traveler = [‘Erin Wilkes’, ‘Shanghai, China’,[‘historical site’, ‘art’]]

def get_destination_index(destination):
destination_index = destinations.index(destination)
return(destination_index)
print(get_destination_index(“Los Angeles, USA”))
#get_destination_index(“Hyderabad, India”)

def get_traveler_location(traveler):
traveler_destination = traveler[1]
traveler_destination_index = get_destination_index(traveler_destination)
return (traveler_destination_index)

test_destination_index = get_traveler_location(test_traveler)
print(test_destination_index)

prints:
2
Traceback (most recent call last):
File “script.py”, line 16, in
test_destination_index = get_traveler_location(test_traveler)
File “script.py”, line 13, in get_traveler_location
traveler_destination_index = get_destination_index(traveler_destination)
File “script.py”, line 6, in get_destination_index
destination_index = destinations.index(destination)
ValueError: ‘Shanghai, China’ is not in list

Make sure you don’t have any typos. The ValueError gives you a hint on what string might be mistyped somewhere in your code.

1 Like

I got it, for some reason it wasn’t printing 1, revised version

destinations = [“Paris, France”, “Shanghai, China”, “Los Angeles, USA”, “São Paulo, Brazil”, “Cairo, Egypt”]
test_traveler = [‘Erin Wilkes’, ‘Shanghai, China’, [‘historical site’, ‘art’]]

def get_destination_index(destination):
destination_index = destinations.index(destination)
return(destination_index)
#print(get_destination_index(“Los Angeles, USA”))
#get_destination_index(“Hyderabad, India”)

def get_traveler_location(traveler):
traveler_destination = traveler[1]
traveler_destination_index = get_destination_index(traveler_destination)
return(traveler_destination_index)
test_destination_index = get_traveler_location(test_traveler)

print(test_destination_index)

got:
1