PatternsinJeopardyQuestions-Copy1.ipynb (17.9 KB)
The mean of the answer in question I calculated is 0.029716. The solution key answer in question mean is 0.05901. Is there a problem with my code? Also, the dataframe for this guided project is a bit different from that of the key. When I read in the file, the first row is different between the file I read in and that of the solution.
Click here to view the jupyter notebook file in a new tab
Please provide also a link to the mission screen.
In your code there is an issue in the code cell . The last
return step is not a part of the for-loop. The value of
match_by_count should be returned after all the iterations of the for-loop are finished, i.e. outside the loop:
for item in split_answer:
if item in split_question:
match_count += 1
match_by_count = match_count / len(split_answer)
Applying this corrected function to
jeopardy['answer_in_question'], you will receive the correct mean.
Hope it helps.