Results for “write”

Showing 21–30 of 79

  1. Challenge

    Summary function

    Write summarise(readings), which returns the count, min, max and mean of a list of readings as one dict, then make it handle a pass with no data and round the mean, so any program can use the summary.

    Write the code Medium 2 stages functions return dictionaries min
  2. Challenge

    Test the alert levels

    Write assert checks for alert_level(): one temperature for each level first, then the values exactly on each threshold and just below them, so a > written instead of >= can't slip through.

    Write the code Medium 2 stages testing assert functions boundaries
  3. 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
  4. 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
  5. Challenge

    Test the parser

    Write assert checks for parse_line() from "Parser function": the whole record for a good line first, then None for a blank line, a comment and a line with a missing field, so a broken parser can't…

    Write the code Medium 2 stages testing assert parsing None
  6. Challenge

    Test the pipeline

    …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 them fail.

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

    CSV row

    Write a telemetry reading as a CSV row with print() and sep, add a header row, then switch to tabs for pasting into a spreadsheet. Real data formats from print().

    Write the code Easy 3 stages print sep csv telemetry
  8. Challenge

    Telemetry from CSV

    …, row["value"] and so on. Leave the lines that write the file as they are. The hottest reading While you loop, keep the hottest reading in degrees Celsius, unit C , in hottest , and print it after the…

    Write the code Medium 2 stages csv csv.DictReader files open
  9. Challenge

    Missing field

    …run the code yet. Read it and decide what it will print. Write your guess in prediction , at the top, between the quotes. Then run it and compare. Any guess passes this stage: the point is to think…

    Fix the code Easy 3 stages dictionaries KeyError get default values