Exam-style question
Try this first
Represent the document "Blue blue bird" as a dictionary, ignoring letter case. State the key-value pair for each distinct word and explain what the values represent.
Model answer
What a good answer should say
- {"blue": 2, "bird": 1}.
- The key "blue" has the value 2 because it occurs twice.
- The key "bird" has the value 1 because it occurs once.
Explanation
Why this works
Each distinct word becomes a key. Its associated value is the number of times that word occurs in the document.
The two instances of "Blue" and "blue" are treated as the same word because letter case is ignored.
Common mistake
No common mistake is linked to this question yet.
