Command-Line Tools Coding Clinic.
Eight coding challenges on argument parsing, defaults, choices, numeric validation, Boolean flags, configuration precedence, status codes and an independent read-only inventory reporter. Build the behavior, not just a sample output.
Testable parser design: Every task passes argument tokens directly as a Python list to parse_args(argv). That runs the real standard-library parser in your browser without launching a shell. Run tests your current code; Check tests the stated sample and extra cases. No real devices, settings, shell commands or customer data are involved.
Write it. Run it. Understand it.
Build reusable argparse parsers, validate CLI input and test configuration logic with explicit argument lists. Shell execution happens on your computer.
Parse a supplied argument list
Define parse_site(argv) using argparse.ArgumentParser with a required --site option. Return the parsed site string, not a Namespace, and do not read sys.argv directly. Use the supplied argv list for 'HQ' and print 'Site: HQ'. The grader calls your function with other site values, and checks that omitting --site is an argparse usage error rather than a guessed default.
Site: HQTry solving it before asking for help. Hints never show a completed program.
Your printed output and errors will appear here.
Run the code, then step through the executed lines to watch variable values change.
