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()…
Showing 1–10 of 20
Challenge
…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()…
Challenge
…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…
Challenge
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…
Challenge
…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…
Challenge
…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…
Challenge
…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…
Challenge
…2 -> Lab, 18.5 kg CG-0043: Airlock -> Node 2, 2.36 kg from_module and to_module are both module names: exactly the pair that is easy to swap.
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
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…
Challenge
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…