Use defaultdict(list) to group these pairs by the first element: ('a', 1), ('b', 2), ('a', 3), ('b',
A medium Python mock interview question on DataDriven. Practice with AI-powered feedback, real code execution, and a hire/no-hire decision.
- Domain
- Python
- Difficulty
- medium
Interview Prompt
Use defaultdict(list) to group these pairs by the first element: ('a', 1), ('b', 2), ('a', 3), ('b', 4), ('c', 5). Print the grouped result as a regular dict with sorted keys.
How This Interview Works
- Read the vague prompt (just like a real interview)
- Ask clarifying questions to the AI interviewer
- Write your python solution with real code execution
- Get instant feedback and a hire/no-hire decision