Results for “keys and values”

Showing 1–10 of 16

  1. Challenge

    Missing field

    …the API hasn't assigned a pad yet. Predict it, check the keys with in, fix it with get() and a default, then print a list of launches with defaults for any missing field.

    Fix the code Easy 3 stages dictionaries KeyError get default values
  2. Challenge

    Unit converter

    …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 offsets for temperatures.

    Write the code Medium 2 stages project dictionaries tuples as keys functions
  3. 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
  4. Challenge

    Line to record

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

    Nested response

    Print the rocket's name and the first mission patch URL from a nested launch response by chaining keys and indexes, then add the operator and orbit and cope with a launch that has no patches yet.

    Write the code Easy 2 stages dictionaries nested data lists JSON
  6. Article Mini projects

    Medical dispenser - Don’t trust the user

    Remember that scene in Project Hail Mary [spoiler alert] by Andy Weir where Dr. Ryland Grace outsmarts the ship's computer? He's in pain, asks for painkillers, and the computer refuses because he…

  7. 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