Skip to content
LakeBench
ProblemsCommunityPricing
Sign inStart practicing

Normalize a batch of phone numbers

Python data engineering interview problem. Difficulty: intermediate. Pattern: Strings. About 15 minutes. Part of the Pro drill bank.

CRM stores phone numbers in whatever format sales typed. Billing needs a normalized form so the same customer is not stored twice.

Normalize a batch of phone numbers to a single comparable form.

Requirements

  • Apply the same normalization to every entry.
  • Keep list order.

Constraints

  • phones: list of raw phone strings.
  • Blanks and already-clean numbers must stay well defined.

Examples

Input: normalize_phones(['(415) 555-1212', '14155551212', '99']) Output: ['415-555-1212', '415-555-1212', None] This input follows the stated rules and produces this output.

Topics: lakebench, python, data-transformation.

More Python interview questions · All interview problems · Learn data engineering

intermediate

Normalize a batch of phone numbers

Interview-style drill: Reformat a list of inconsistently formatted phone numbers into one standard shape.

Normalize a batch of phone numbers to a single comparable form.