Results for “module”

Showing 11–20 of 30

  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

    JSON out

    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…

    Write the code Easy 2 stages json json.dumps modules import
  3. Challenge

    Live T-minus

    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…

    Write the code Medium 2 stages datetime datetime.now timezone countdown
  4. Challenge

    Seeded simulation

    Simulate 100 sensor readings, each with a 5% chance of a glitch, and seed random with 42 so the count is the same on every run and a test can check it exactly, then pick a kind for each glitch with…

    Write the code Easy 2 stages random random.seed random.choice simulation
  5. Challenge

    Alert banner

    …============================== ALERT: Cabin pressure low Module: Habitat 2 Action: Crew to suits ============================== Each new line inside the text needs its own \n . Title in the border…

    Write the code Medium 3 stages f-strings escape sequences new line formatting
  6. Challenge

    Names that explain

    Somebody wrote a quick calculation for the cargo module and called the variables a , b , x2 and tmp . The program works, but nobody, including its author a month from now, can tell what it calculates…

    Fix the code Easy 3 stages variable names refactoring readability clean code
  7. Article Python Fundamentals

    Nested Loops in Python

    …sensor", "Wheel drive", "Robotic arm", "Soil analysis module" ] print("=== STARTING SECTOR SCAN ===\n") # First loop: scan the map for scan_y in range(10): for scan_x in range(10): # Second loop…

  8. Challenge

    Manifest line

    …in order. A new field The manifest now also records the module each item is stowed in. The starter code stops with ValueError: too many values to unpack , because the tuple has four values and only…

    Write the code Easy 2 stages tuples unpacking ValueError formatting