Results for “module”

Showing 1–10 of 20

  1. Challenge

    Statistics module

    …tested, in its standard library. Use them instead. Use the module Delete the hand-written mean() and median() , add import statistics at the top, and print the same two lines with statistics.mean()…

    Fix the code Easy 2 stages statistics mean median stdev
  2. Challenge

    Logging instead of print

    …tank, under lines nobody needs. Switch to the logging module, where every message has a level and you decide which levels to show. Levels instead of prints Replace each print() with the logging call…

    Fix the code Medium 2 stages logging debug info warning
  3. 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
  4. Challenge

    Mission elapsed time

    …stations don't even agree on a time zone. Let the datetime module do the counting. Subtract two timestamps Parse both timestamps with datetime.fromisoformat() into launched and latest , subtract them…

    Write the code Medium 2 stages datetime timedelta ISO 8601 time zones
  5. Challenge

    Real JSON

    …that text into data. Do that step yourself with the json module, then deal with a response that didn't arrive in one piece. json.loads() The prints from "API response" expect a dict, but response_text…

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

    Telemetry from CSV

    …changes every few seconds. Read the file itself, with the module made for it, then pick out the hottest reading. csv.DictReader Replace the old parser and its feed string: open telemetry.csv with…

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

    Counter

    Refactor the level counter from "Entries per level": replace the dict and counts.get() with collections.Counter, which starts every key at 0, then list the levels from most to least common with…

    Fix the code Easy 2 stages collections Counter most_common dictionaries
  8. Challenge

    JSON out

    Turn the day's mission summary dict into JSON text with json.dumps() and indent=2, see what True, False and None become, then keep the station's Polish letters readable and sort the keys so the files…

    Write the code Easy 2 stages json json.dumps modules import
  9. Challenge

    Live T-minus

    Extend the formatter from "Duration formatter": work out the seconds left from the launch time and datetime.now(timezone.utc) instead of a number typed by hand, then turn it into a countdown() that…

    Write the code Medium 2 stages datetime datetime.now timezone countdown