Challenge
Count warnings
Count the entries and the WARN lines in a multi-line mission log with count(), fix the count when a message mentions WARN itself, then summarise the log by level.
Showing 1–10 of 48
Challenge
Count the entries and the WARN lines in a multi-line mission log with count(), fix the count when a message mentions WARN itself, then summarise the log by level.
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
record_launch() adds 1 to a global counter and stops with an UnboundLocalError. Predict it, find out why Python treats the name as local, fix it by passing the count in and returning the new one, then…
Challenge
Print a launch countdown from T-10 to T-0 with range(10, -1, -1), adding a hold line at every second listed in holds, then scrub the launch at a given second with break, or print Liftoff! at the end.
Challenge
…mission log into answers: parse each line into a dict, count the entries per level and per hour, find the first ERROR, then rank the subsystems by how many warnings they raised.
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
…instead of a number typed by hand, then turn it into a countdown() that counts up with T+ after launch.
Challenge
…a for loop runs it over every temperature in a list, then count the WARN and CRITICAL readings for a summary line.
Challenge
…come within 60 seconds of the first into one line with a count, in the order they first appeared, then add the time range and a summary.
Challenge
Write summarise(readings), which returns the count, min, max and mean of a list of readings as one dict, then make it handle a pass with no data and round the mean, so any program can use the summary.