List Practice Pack Question

The question ask:
Given a 2D list cities = [['New York', 'Boston', 'Atlanta'] , ['Seattle', 'Oregon', 'San Francisco'] , ['Denver', 'Austin', 'Chicago']] , use indexes to locate and change San Francisco to San Diego .

My answer was:

cities = [['New York', 'Boston', 'Atlanta'], ['Seattle', 'Oregon', 'San Francisco'], ['Denver', 'Austin', 'Chicago']] cities[1].remove('San Francisco') cities[1].insert(2, 'San Diego') print(cities)

It’s asking me “Did you use the correct index for both sublist and element?” and it won’t let me move on. I’m not sure where I went wrong because it prints out the correct answer.

https://www.codecademy.com/practice/tracks/learn-python-3/modules/learn-python3-lists

You can do the same without remove and insert, using only the indices to access or change the string in the nested lists.

cities[1][2] = 'San Diego'
2 Likes