Results for “python dict”

Showing 31–37 of 37

  1. Challenge

    Undo and history

    Extend the working cargo console: record every change to the hold in a history list and show it with a history command, then add undo, which takes the last change off the history and reverses it.

    Write the code Hard 2 stages project lists stack append
  2. Challenge

    Unit converter

    Write convert(), which looks a unit pair up in a table of factors, works the other way round by dividing, and refuses unknown units or missing pairs with a clear ValueError, then extend the table with…

    Write the code Medium 2 stages project dictionaries tuples as keys functions
  3. Challenge

    Manifest validator

    Write problems(item), which lists everything wrong with one cargo item: missing fields, a mass that isn't a number, is 0 or is over the limit. Print a pass or fail line per item, then catch duplicate…

    Write the code Medium 2 stages project validation dictionaries functions
  4. 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
  5. Challenge

    Shared default list

    …new_record(sensor, value, flags=None) , which returns a dict with a fresh flags list whenever none is given. The program flags the first record, and the second must stay clean: {'sensor': 'ENG-2'…

    Fix the code Medium 3 stages functions default values mutable defaults None
  6. Challenge

    Test the pipeline

    The telemetry pipeline is now split into parse_row() and check_limits(). Write assert tests for both, good rows, rejected rows and readings right at a limit, so that each of three planted bugs makes…

    Write the code Hard 2 stages project testing assert try
  7. Challenge

    Seeded simulation

    …right after the check that found it, count the kinds in a dict called by_kind , and print them sorted after the total: Glitches in 100 readings: 5 DROPOUT: 3 SPIKE: 2 Call random.choice() only for…

    Write the code Easy 2 stages random random.seed random.choice simulation