Loading Teachly…
An AI assistant wrote count_word_occurrences(words) to count how many times each word appears, returned as a list of [word, count] pairs. It passes a quick manual check — but call it twice and watch closely.
count_word_occurrences(['a', 'b', 'a']) contains ['a', 2] and ['b', 1] (order doesn't matter). Calling it again afterward with a different, unrelated list must NOT include counts left over from the previous call.