Question
Which statement about defaultdict for Grouping is the strongest interview answer?
- defaultdict supplies a default value factory so grouping and aggregation code can avoid repeated missing-key checks.
- defaultdict for Grouping is mostly a naming style choice and has little effect on runtime behavior or design tradeoffs.
- defaultdict for Grouping exists mainly to reduce the number of files in a Python project.
- defaultdict for Grouping matters only for frontend scripting and not for backend or automation code.
Hint
Start with the core rule behind defaultdict for Grouping.
Answer and rationale
Correct answer: A. defaultdict supplies a default value factory so grouping and aggregation code can avoid repeated missing-key checks.
defaultdict supplies a default value factory so grouping and aggregation code can avoid repeated missing-key checks. This is the base concept interviewers commonly test first.
Track: Python