Results for “print”

Showing 131–140 of 150

  1. Challenge

    Live T-minus

    …before launch, and at launch itself, and T+ after it, then print countdown(launch, datetime.now(timezone.utc)) . With the clock stopped five minutes after launch, the check expects: T+00:05:00 Pick…

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

    Test the error

    …to True in except ValueError: , and assert it after. Then print: All checks passed Leave the function as it is. The hidden tests swap it for a version that doesn't raise at all, and one that raises…

    Write the code Medium 2 stages testing assert try except
  3. Challenge

    Prove the fix

    …check each call got a list with only its own sample. Then print: All checks passed Leave the function as it is. The hidden tests swap it for the old version with log=[] , and your checks must stop…

    Write the code Medium 2 stages testing assert regression tests default values
  4. Challenge

    Edge cases

    …isn't a whole number, such as [1, 2] . When they all hold, print: All checks passed Leave the function exactly as it is. The edges Now the edges. Add checks that an empty list gives None (compare with…

    Write the code Medium 2 stages testing assert edge cases None
  5. Challenge

    Test the alert levels

    …OK, one for WARN and one for CRITICAL. When they all hold, print: All checks passed For example, assert alert_level(20) == "OK" . Leave the function exactly as it is: the hidden tests break copies of…

    Write the code Medium 2 stages testing assert functions boundaries
  6. Challenge

    Test the parser

    …every field and its type are checked. When they all hold, print: All checks passed For example, a line from the feed, "2026-03-14T09:30:05Z,ENG-2,412.5,C" , should give {"time": "09:30:05", "sensor"…

    Write the code Medium 2 stages testing assert parsing None
  7. Challenge

    Settings with defaults

    …Leave DEFAULTS unchanged, since every user shares it. Then print every setting: units: imperial language: en telemetry_rate_hz: 10 dark_mode: True alerts: all DEFAULTS.copy() makes a separate dict…

    Write the code Medium 2 stages dictionaries copy update defaults
  8. Challenge

    File name from data

    …ID in lower case, an underscore, the date and .csv . Then print it: File: eng-2_2026-03-14.csv Inside an f-string's braces you can call methods too: {sensor_id.lower()} . From a name The configuration…

    Write the code Easy 3 stages strings f-strings lower replace
  9. Challenge

    Tank level

    …shows. Fill percentage Work out how full tank B is and print it as a percentage with one decimal place: Tank B: 73.4% Divide what's in the tank by what it can hold, then multiply by 100. Gauge The…

    Write the code Easy 2 stages percentage division rounding string repetition
  10. Challenge

    Safe mode

    …fired first. With the battery at 18% and contact fine, it prints the second line.

    Write the code Medium 2 stages if elif or and