Log inBook a Demo
BuildMidFrontendAuto-graded

Parse and rebuild URL query strings by hand

Rebuilding a standard web utility by hand shows whether special characters, repeated values and blanks are handled correctly.Implement the URL query-string codec that sits at the core of every web framework: parse() turning a query string into a dictionary, and stringify() as its stable inverse. The rules are the fiddly part — percent-decoding on both keys and values, splitting each pair on the first equals sign only, repeated keys collapsing into lists, and empty values surviving. Write it yourself rather than calling the standard library's parser.
35 min
python

You're done when

  • Ordinary query strings parse into the expected structure.
  • Percent-encoded sequences decode correctly, in keys as well as values.
  • A repeated key collects its values into a list.
  • Empty values are preserved rather than dropped.
  • Parsing matches a reference implementation across a broad set of inputs.
  • Stringify produces correct output, percent-encodes what needs encoding, and expands lists back into repeated keys.
  • Parse and stringify round-trip cleanly.
  • The built-in query-string helpers are not used.

What it measures

Back-end developmentImplementing a codec that framework code depends on, with the encoding rules applied in the right places.
PythonHandling bytes, percent-decoding and UTF-8 in the correct order so multi-byte characters survive.
Inverse correctnessBuilding two functions that are genuine inverses, including on repeated keys and empty values.

Your environment

Terminal + editorA full shell in the browser
Claude CodePre-authenticated, no key setup
Isolated microVMYours alone, wiped afterwards

Start this lab

35 min
Start labYou'll sign in to Anthropos to start. The lab opens in a private cloud workspace with Claude Code ready to use.
AI Labs is part of Anthropos Workforce. Not on your plan yet? Book a demo