Challenge
Logging instead of print
…the logging call for its level: logging.debug() , logging.info() , logging.warning() or logging.error() , and drop the level from the text, since the format adds it. With the level set to INFO , the…
Showing 1–10 of 12
Challenge
…the logging call for its level: logging.debug() , logging.info() , logging.warning() or logging.error() , and drop the level from the text, since the format adds it. With the level set to INFO , the…
Challenge
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.
Challenge
Turn values into a log line like [T+00:12:05] INFO Engines nominal with an f-string, then build the timestamp from numbers with zero padding.
Challenge
…are new lines. Don't be fooled A new entry has come in: INFO WARN light test complete . It's an INFO entry about the warning light, but the starter code now counts 4 warnings. Make the count match…
Challenge
…+= 1 . The output stays as it was: DEBUG: 2 ERROR: 1 INFO: 4 WARN: 3 Most common first Replace the sorted listing with one from the most common level down, using counts.most_common() , under a…
Challenge
…written as JSON: downlink_rate_kbps = "256" log_level = "INFO" log_levl = "DEBUG" retries = 12 safe_mode = "yes" timeout_s = 2.5 dict(DEFAULTS) makes the copy and update() fills it in…
Challenge
…first, and per hour, in time order: By level: WARN: 6 INFO: 5 ERROR: 2 By hour: 09:00: 4 10:00: 4 11:00: 5 Two Counter s do the counting; the hour is the first two characters of the time, plus ":00"…
Challenge
…use min_level in the first line of the output: LEVELS = ["INFO", "WARN", "ERROR"] # from least to most serious min_level = "WARN" # show this level and above WARN and above: 4 [T+00:12:05] WARN…
Challenge
…and print each line without its line break: [T+00:10:00] INFO Orbit insertion complete [T+00:12:05] WARN Battery 3 temperature high [T+00:14:47] ERROR Fuel valve 2 not responding The hidden tests also…
Challenge
…The output must stay exactly the same: [T+00:12:05] INFO Engines nominal Define the function at the top: def format_log(t, level, msg): , with return f"..." inside, using its own parameter names. Then…