I am stuck in this part of the lab from C3W1

Hello I am stuck in this part and I have tried with different combinations to get the probability of lottery and schedule, spam and ham but I continue getting the same error, could you help me with a hint or clue please?

!{Image removed by moderator as it contained codes from grader cell}

Kindly move your query to the right category of specialisation, course, week and assignment name for better response.

In case when you are unsure on how to do that, give details in the topic explanation so others can move it to right category.

Also you are not suppose to share your codes screenshot which will grade your assignment. It is against community guidelines. So kindly remove that image.


You have posted in the general “AI Questions” area. That’s not used for specific course issues.

You can move your thread to the forum area for your course by using the “pencil” icon in the thread title.

All the courses are in the “Course Q&A” area. Select your course and add a week tag.

I suspect there is an error in your prob_word_given_class() function.

Verify that your code only uses the variables that are passed to the function.

  • Don’t use any global variables.
  • Don’t use any fixed values like ‘ham’ or ‘spam’.

Make sure that the training percentage is the same (0.8)

However that has nothing to do with the “KeyError” message.