Skip to main content

Python / coding round

The DE coding round is usually less algorithmic than a software engineering one, and more about data: parsing messy input, streaming large files, calling flaky APIs, transforming records, and writing code you'd trust in a pipeline.

What gets tested​

  • Parsing and validation: logs, CSV, JSON with missing or wrong fields. Never crash on one bad record; count and report it.
  • Streaming and memory: generators, itertools, processing a file bigger than RAM.
  • APIs: pagination, rate limits, retries with backoff, idempotent writes.
  • Data transforms: dedup, group, merge, join two lists of records.
  • Light algorithms: dictionaries and sets, sorting, sliding windows, merging intervals, top-k with a heap. Rarely graphs or dynamic programming.
  • Testing: can you write a few good asserts or pytest cases for your own code?

How to approach a coding question​

  1. Clarify input and output. Types, sizes, can it be empty, what to do with bad records.
  2. Write the signature and one example first. It forces precision.
  3. Start simple and correct, then improve. Say the complexity.
  4. Handle the edge cases explicitly: empty input, duplicates, malformed lines, ties.
  5. Test it. Write two or three asserts, including an edge case. Interviewers notice when you test without being asked.
  6. Talk about production: "In a pipeline I'd log the bad lines to a quarantine file and emit a metric."

Python that reads like a data engineer wrote it​

  • Use csv, json, datetime, collections (defaultdict, Counter), itertools (islice, groupby) and heapq from the standard library before reaching for pandas.
  • Prefer generators for anything row-by-row, and return plain data structures.
  • Inject dependencies (the HTTP call, the clock, sleep) so the code is testable.
  • Use datetime with time zones (datetime.fromisoformat, timezone.utc) and never compare naive and aware datetimes.
  • Don't use floats for money. Use integer cents or decimal.Decimal.

Practice​

Every question has a Try it in the Python playground button: write your solution in the browser and press Run tests to check it against the question's tests. Python runs locally in your browser (Pyodide), so nothing is sent anywhere, and a runaway loop is stopped after 10 seconds. The reference solutions are checked against the same tests in CI.