Results for “count”

Showing 1–10 of 48

  1. 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.

    Write the code Medium 3 stages strings count multi-line strings logs
  2. Challenge

    Counter

    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…

    Fix the code Easy 2 stages collections Counter most_common dictionaries
  3. Challenge

    Launch counter crash

    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…

    Fix the code Medium 3 stages functions scope UnboundLocalError global
  4. Challenge

    Countdown with holds

    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.

    Write the code Easy 2 stages for loop range negative step in
  5. Challenge

    Log analyser

    …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.

    Write the code Hard 3 stages project logs parsing Counter
  6. 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
  7. Challenge

    Check every reading

    …a for loop runs it over every temperature in a list, then count the WARN and CRITICAL readings for a summary line.

    Write the code Easy 2 stages for loop lists if elif
  8. Challenge

    Summary function

    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.

    Write the code Medium 2 stages functions return dictionaries min