Parsing Markdown Tables

medium
Checkpoint challenge
Solve this to show you know the material and jump straight to Unit 16. Everything before it counts as cleared.

Implement parse_table(md) that turns a Markdown pipe table into a list of dicts:

| name | qty |
|------|----:|
| pen  | 3   |
  • the first row is the header, the second is the separator (cells of dashes with optional colons) and must be present, otherwise raise ValueError
  • leading/trailing pipes are optional; cells are stripped
  • escaped pipes \| inside cells are literal |
  • rows with fewer cells are padded with ""; rows with more raise ValueError
  • ignore blank lines
#parsing#markdown2 visible + 1 hidden tests
solution.py · Python 3.13
Loading editor…
Run your code to see results. ⌘↵ to run · ⌘⇧↵ to submit
Parsing Markdown Tables · TechGradify