Skip to content
LakeBench
ProblemsCommunityPricing
Sign inStart practicing

Parse a delimited inventory line

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

Inventory comes in as one delimited line from a handheld scanner. You need named fields, not a raw string, before it can land in a warehouse table.

Parse a delimited inventory line into the structured fields the tests expect.

Requirements

  • Split on the delimiter used in the tests.
  • Strip padding; types should match the expected record.

Constraints

  • Malformed lines should follow the tests (partial fields vs error).

Examples

Input: parse_inventory_line('SKU-1|widget|12|3.5') Output: {'sku': 'SKU-1', 'name': 'widget', 'qty': 12, 'price': 3.5} This input follows the stated rules and produces this output.

Topics: lakebench, python, parsing.

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

beginner

Parse a delimited inventory line

Interview-style drill: Parse a pipe-delimited inventory record into a structured dictionary.

Parse a delimited inventory line into the structured fields the tests expect.