I completed the Winning Jeopardy guided project. However, I’m getting a different result from the one in the solution book on the part, where we develop a count_usage and determine_value function. I looked at the solution book and copy-pasted the code on there. However, I still get a different result. I want to understand why I’m getting a different result than the one in the solution book, even though I ran the same code.
My result:
[(0, 1), (1, 0), (1, 4), (0, 2), (0, 1)]
Solution key:
[(2, 4), (0, 1), (4, 0), (1, 0), (0, 1)]
Solution key code
def count_usage(term):
low_count = 0
high_count = 0
for i, row in jeopardy.iterrows():
if term in row["clean_question"].split(" "):
if row["high_value"] == 1:
high_count += 1
else:
low_count += 1
return high_count, low_count
comparison_terms = list(terms_used)[:5]
observed_expected = []
for term in comparison_terms:
observed_expected.append(count_usage(term))