The Record Reconciler
A medium Python interview practice problem on DataDriven. Write and execute real python code with instant grading.
- Domain
- Python
- Difficulty
- medium
- Seniority
- L4
Problem
Given source_a and source_b (each a list of dicts) and an id_field name, reconcile the two by id and return a dict with four keys: 'only_a' (sorted list of ids in source_a but not source_b), 'only_b' (sorted list of ids in source_b but not source_a), 'matches' (sorted list of ids whose records are identical in both sources), and 'mismatches' (sorted list of {'id': id, 'differences': {field: {'a': a_val, 'b': b_val}}} dicts for ids whose records differ on at least one non-id field).
Summary
Two versions of the same truth.
Practice This Problem
Solve this Python problem with real code execution. DataDriven runs your Python code in a real environment and grades it automatically.