You must select a tag to post in this category. Please find the tag relating to the section of the course you are on E.g. loops, learn-compatibility
Hello,
I am stuck on the python exercise “The Boredless Tourist”:
The Boredless Tourist
I completed 1 to 28.
Then it say to skip 29 and 30, and I just don’t understand 31, I do not understand what is asked of me to do.
I have this now (up to 28)
destinations = ["Paris, France", "Shanghai, China", "Los Angeles, USA", "Sao Paulo, Brazil", "Cairo, Egypt"]
test_traveler = ["Erin Wilkes", "Shanghai, China", ["historical site", "art"]]
#attractions = []
#for _ in destinations:
# attractions.append([])
attractions = [ [] for _ in destinations]
#def get_destination_index(destination):
# for i in range(len(destinations)):
# if destination == destinations[i]:
# destination_index = i
# return destination_index
def get_destination_index(destination):
destination_index = destinations.index(destination)
return destination_index
def get_traveler_location(traveler):
traveler_destination = traveler[1]
traveler_destination_index = get_destination_index(traveler_destination)
return traveler_destination_index
def add_attraction(destination,attraction):
destination_index = get_destination_index(destination)
test_destination_index = get_traveler_location(test_traveler)
print(test_destination_index)
# For testing pursposes
print(get_destination_index("Los Angeles, USA")) # This works fine
print(attractions)
If anyone could make me understand, thanks in advance