Results for “print function”

Showing 21–30 of 39

  1. Challenge

    Validate a cargo record

    …with it, not just the first problem. Write the check as a function that collects the problems, then add a rule for the ID format. Missing fields and negative mass Write validate_cargo(item) , which…

    Write the code Medium 2 stages functions return lists validation
  2. Challenge

    Log to a file

    …with with open(), one per line, read the file back and print it, then add an append_entry() function that adds lines at the end without wiping what is there.

    Write the code Easy 2 stages files open with write
  3. Challenge

    Prove the fix

    …it stays fixed? Six months from now someone will tidy the function, and log=[] looks so much simpler than the None check. Write the test that proves the fix: it has to pass now and fail on the old…

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

    Test the parser

    Write assert checks for parse_line() from "Parser function": the whole record for a good line first, then None for a blank line, a comment and a line with a missing field, so a broken parser can't…

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

    Launch schedule digest

    …the launches still to come, sort them by their window and print a digest line for each with the time left and any hold, then switch the digest to the live clock.

    Write the code Medium 3 stages project json datetime timedelta
  6. Challenge

    Test the error

    …with a ValueError . That refusal is part of what the function promises, as much as the arithmetic is, and like the arithmetic it can quietly break. Write the test that keeps it honest. The hidden…

    Write the code Medium 2 stages testing assert try except