Results for “errors”

Showing 21–30 of 55

  1. Challenge

    Log to a file

    …[T+00:12:05] WARN Battery 3 temperature high [T+00:14:47] ERROR Fuel valve 2 not responding The hidden tests also open mission.log and check what is in it. Append without wiping Opening with "w" again…

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

    Signal delay

    …then add the round trip without doubling a rounding error.

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

    Config loader

    …is not valid JSON is one problem, not valid JSON: and the error's msg ; JSON that is not an object, such as a list, is one problem too. In both cases the config is a copy of the defaults. Only…

    Write the code Hard 3 stages project json configuration validation
  4. Challenge

    Counter

    …counts[level] += 1 . The output stays as it was: DEBUG: 2 ERROR: 1 INFO: 4 WARN: 3 Most common first Replace the sorted listing with one from the most common level down, using counts.most_common()…

    Fix the code Easy 2 stages collections Counter most_common dictionaries
  5. Article Mini projects

    Medical dispenser - Don’t trust the user

    …event {i}") return events except Exception as e: print(f"Error loading log: {e}") return [] def _save_log(self): """Persist event log to disk""" with open(self.log_file, 'w') as f…

  6. Challenge

    Extra log fields

    …passed: [T+00:12:05] INFO Engines nominal [T+00:14:47] ERROR Fuel valve 2 not responding valve=2 pressure_kpa=310 Add **fields after msg . Inside, fields is a dict: build the line, then loop over…

    Write the code Medium 2 stages functions **kwargs keyword arguments dictionaries
  7. Challenge

    Log formatter function

    …The function is now used for a whole orbit's entries, and ERROR is five letters long, so its messages start one column later than the others. Change only the function so the level is padded to five…

    Fix the code Easy 2 stages functions def return refactoring
  8. Challenge

    Validate a command

    …are typed, reject everything else clearly, then make the error messages helpful. Three commands Ask for a command with input() . Accept start , stop and status in any case and with spaces around them…

    Write the code Easy 2 stages if elif else input
  9. Challenge

    Command parser

    Write parse_command(), which turns typed commands such as burn 12.5 or set mode safe into tuples and raises ValueError with a reason for anything malformed, then run a whole batch of commands and…

    Write the code Medium 2 stages project parsing strings split