Results for “items”

Showing 11–20 of 27

  1. Challenge

    Sort by a field

    …dates in order, and the loading crew wants the heaviest items first, because they go lowest in the racks. Sort both lists by one of their fields. By date Print the launches from the earliest date to…

    Write the code Easy 2 stages functions sorted key reverse
  2. Challenge

    Mass by category

    The load planners don't need every item: they need to know how much each kind of cargo weighs, because food, life support and spares go into different racks with different mass limits. Total the…

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

    Extra log fields

    …fields is a dict: build the line, then loop over fields.items() and add to it. Fields from dicts The fields often come ready in dicts. Pass them as keyword arguments with ** : first reading alone…

    Write the code Medium 2 stages functions **kwargs keyword arguments dictionaries
  4. Challenge

    Logging instead of print

    The tank check is full of prints left over from debugging. Replace them with logging calls at the right levels, so debug records stay hidden until switched on, then give the fuel code its own named…

    Fix the code Medium 2 stages logging debug info warning
  5. Challenge

    Ground pass planner

    From today's passes over four ground stations, collect every contact window longer than 8 minutes into one list, sorted by time, then find the longest stretch with no station in contact, counting…

    Write the code Medium 2 stages project datetime timedelta sorting
  6. Challenge

    Read the traceback

    A Python program stops with a traceback. Read it from the bottom up to find the error, the function and the line, fix the bug there, then follow a longer traceback through four calls to a second bug.

    Fix the code Easy 2 stages errors traceback KeyError TypeError
  7. Challenge

    Entries per level

    Count the mission 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
  8. Challenge

    Undo and history

    …and record every change that actually happens as (action, item, mass) : ("add", "CG-0042", 18.5) or ("remove", "CG-0042", 18.5) . Refused commands change nothing, so they aren't recorded. Add a…

    Write the code Hard 2 stages project lists stack append