Results for “validation”

Showing 1–10 of 15

  1. Challenge

    Validate a cargo record

    Write validate_cargo(item), which returns a list of everything wrong with a cargo record: missing fields and a negative mass, then a cargo ID that doesn't match the CG- and four digits format. An…

    Write the code Medium 2 stages functions return lists validation
  2. Challenge

    Manifest validator

    …a 61 kg battery pack to a shelf rated for 50. Write the validator that reads every item and says exactly what is wrong with each one, all at once, so the team can fix the list in one go. Every…

    Write the code Medium 2 stages project validation dictionaries functions
  3. Challenge

    Validate a command

    Read a console command with input(), accept start, stop and status in any case with an if/elif chain, print Unknown command for anything else, then handle empty input and show what was typed.

    Write the code Easy 2 stages if elif else input
  4. Challenge

    Telemetry pipeline

    …and leave a summary the dashboard can read. Three stages: validate, flag, save. Validate the rows Read telemetry.csv with csv.DictReader . Reject a row whose sensor is not in LIMITS , or whose value…

    Write the code Hard 3 stages project csv json files
  5. Challenge

    Sign-up cleanup

    Clean the crew sign-ups for the analogue mission: trim and capitalise names, lower-case emails, then reject sign-ups with no name or a broken email and drop duplicates by email, saying why for each…

    Write the code Medium 2 stages project strings strip split
  6. Challenge

    Config loader

    Load the downlink module's JSON settings over a copy of the defaults, check each value's type and range and report every problem in one go, then wrap it all in a load_config() that never crashes, even…

    Write the code Hard 3 stages project json configuration validation
  7. Challenge

    Clear error messages

    fuel_needed() quietly returns negative fuel for a negative burn length. Make it raise ValueError with a message that shows the bad value, then raise TypeError, checked first, when the length isn't a…

    Write the code Medium 2 stages errors raise ValueError TypeError
  8. Challenge

    Safe number input

    The burn length is typed in by hand, and a typo stops the program with a ValueError. Catch it with try and except, keep asking until the input is a number, then also turn away zero and negative…

    Write the code Easy 2 stages errors try except ValueError
  9. Challenge

    Settings with defaults

    Build a user's settings by copying the defaults and laying their own values on top with update(), so any setting they haven't changed falls back, then warn about unknown keys instead of saving them.

    Write the code Medium 2 stages dictionaries copy update defaults
  10. Challenge

    Names with values

    Print each sensor name with its reading by looping over two lists together with zip(), then add a third list of units and warn when the lists don't have the same length, since zip() quietly stops at…

    Write the code Easy 2 stages for loop zip lists unpacking