Debugging submission failures - Module 3, Exercise 3

Hi there,

I’m trying to understand why my submission is failing on Module 3, Exercise 3. Specifically, I have added my code to the _create_training_embeddings and _calculate_similarity_and_select_indices functions and can successfully run the subsequent cell (the one starting with

# Identify error patterns from your analysis
print(“Creating training examples from train set based on error patterns…”)

However, when I submit the notebook for grading, I am not getting any points and get the following error:

Overall Score: 0.00 (0.0/1 exercises) 
Exercise Results: FAIL ex3: 0.00 - Passed 0/1 tests - 
Function execution failed: list indices must be integers or slices, not str 
FAILED! Overall score 0.00 was below 0.70 
Focus on the exercises marked with FAIL above.

My question is, how do I isolate the issue? There are two code blocks I have modified, and only one test so I’m not sure what this is testing.

Thanks.

1 Like

It’s hard to pinpoint the exact issue without seeing your code, but the error “list indices must be integers or slices, not str” means you’re trying to use a string to access an item in a list.

This usually happens when a function returns a list of dictionaries. Even if that list only contains one item, it is still a list, not the dictionary itself. A common mistake is trying to access a key directly, like mylist[“mykey”], when you actually need to specify the index first, like mylist[0][“mykey”].