Challenge
Index by ID
…each cargo ID to its record, then look up wanted in it and print the record: CG-0045 | CO2 scrubber cartridges | life support | 31.3 kg Start with by_id = {} and, for each record, store it under…
Showing 141–150 of 150
Challenge
…each cargo ID to its record, then look up wanted in it and print the record: CG-0045 | CO2 scrubber cartridges | life support | 31.3 kg Start with by_id = {} and, for each record, store it under…
Challenge
Extend the working cargo console: record every change to the hold in a history list and show it with a history command, then add undo, which takes the last change off the history and reverses it.
Challenge
Replace three copy-pasted tank-status blocks with a list of (name, level) pairs and one loop, keeping the output exactly the same, then add a fourth tank with a single list item and list the low…
Challenge
Add a docstring to fuel_needed() that says what it returns and what the reserve means, then add type hints for its parameters and return value; the tests read both from the function itself.
Challenge
Move the feed parser from "Line to record" into parse_line(line), which returns the record dict, then let it return None for blank, comment and damaged lines so the loop only keeps real records.
Challenge
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…
Challenge
Work out how many 12-slot crates 100 sample tubes fill with // and %, then how many crates they need and how full the last one is, including the case where the tubes fit exactly.
Challenge
The monitoring system raises the same alert over and over. Group repeats of an alert that come within 60 seconds of the first into one line with a count, in the order they first appeared, then add the…
Challenge
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…
Challenge
Extend format_log() from "Log formatter function" with **fields, so any extra keyword arguments are added to the line as key=value pairs, then pass whole dicts of fields into it with ** at the call.