Results for “python dict”

Showing 1–10 of 37

  1. Challenge

    Real JSON

    The launch code from "API response" worked on a ready-made dict, but the API really sends JSON text. Turn it into a dict with json.loads(), see what false and null become, then handle a response cut…

    Write the code Easy 2 stages json json.loads modules import
  2. Challenge

    API response

    Print the name, provider and status of a launch from a dict shaped like a launch-API response, then list every field the response has with items(), the way you'd inspect an API you haven't used…

    Write the code Easy 2 stages dictionaries keys items JSON
  3. Challenge

    Summary function

    …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
  4. Challenge

    Index by ID

    Build a dict that maps every cargo ID to its record, so any item is found with one lookup instead of a search through the list, then answer a list of requests, including an ID that isn't on the…

    Write the code Medium 2 stages dictionaries indexing lookup in
  5. Challenge

    Mass by category

    Add up the cargo mass of each category into a dict with totals[category] = totals.get(category, 0) + mass, then list the categories from heaviest to lightest with their share of the load.

    Write the code Medium 2 stages dictionaries grouping get sorted
  6. Challenge

    Entries per level

    …log's entries per level, INFO, WARN and ERROR, in a dict of counters, then count any level at all with get() when DEBUG lines turn up, and print the levels in alphabetical order.

    Write the code Easy 2 stages dictionaries counting get sorted
  7. Challenge

    Line to record

    Extend the feed parser so it stores every reading as a dict with time, sensor, value and unit in a list of records, then let other code pick out one sensor's readings by key.

    Write the code Easy 2 stages dictionaries lists parsing records
  8. Challenge

    Nested response

    …doesn't keep everything at the top level: the rocket is a dict of its own, and the mission holds a list of patch images. The public launch page shows the rocket and the mission patch. Dig the two…

    Write the code Easy 2 stages dictionaries nested data lists JSON
  9. Challenge

    Telemetry from CSV

    …"Parse the whole feed" at telemetry.csv: read it with csv.DictReader, using the header row for the field names, then find the hottest temperature reading, comparing the values as numbers.

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