Results for “print”

Showing 151–160 of 237

  1. Challenge

    Date and time from a timestamp

    …the date and the time of day out of the timestamp and print them: Date: 2026-03-14 Time: 09:30:05 The date is the first 10 characters. The time starts after the T , at index 11, and is 8 characters…

    Write the code Easy 2 stages strings slicing indexing timestamp
  2. Challenge

    Search the log

    …the error message that follows. Is it there, and where? Print whether the line contains ERROR , and the index where it starts: Contains ERROR: True Starts at: 13 "ERROR" in line gives True or False…

    Write the code Medium 2 stages strings in find slicing
  3. Challenge

    Fuel for a burn

    …every second. Read the burn length with input() and print the fuel it uses, with one decimal place. For 42 : Fuel used: 315.0 kg input() always gives text, so turn it into a number with float()…

    Write the code Easy 2 stages input float type conversion multiplication
  4. Challenge

    Signal delay

    …out how long a radio signal takes to reach the orbiter and print it with one decimal place: One-way delay: 750.5 s Time is distance divided by speed. The speed of light is already in the code as a…

    Write the code Medium 3 stages division round // %
  5. Challenge

    Test the pipeline

    …and a row from an unknown sensor raises ValueError . Then print: All checks passed Leave the functions as they are. The hidden tests plant two bugs in parse_row() : one keeps the value as text, the…

    Write the code Hard 2 stages project testing assert try
  6. 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
  7. 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
  8. 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
  9. 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
  10. 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