Results for “insert”

Showing 11–16 of 16

  1. 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
  2. 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
  3. Challenge

    Filter the log

    Go through the mission log and build a new list holding only the WARN and ERROR entries with append(), then let a minimum level decide what counts, the way logging tools filter by severity.

    Write the code Medium 2 stages for loop lists append filtering
  4. Challenge

    First error

    Scan the mission log for the first ERROR entry, print its line number with enumerate() and stop there with break, then report how many lines were checked, or that there were no errors at all.

    Write the code Easy 2 stages for loop break enumerate flags
  5. Article Python Fundamentals

    Python If/Else for Beginners

    …= 75 if fuel_percent > 50: print("Proceed to orbit insertion burn.") If fuel_percent > 50 is True , the indented block runs. If it's False , Python skips the block entirely. else — the fallback plan…