Results for “parsing”

Showing 1–10 of 11

  1. Challenge

    Parser function

    …bugs get fixed in one place and not the other. Turn the parsing into a function that any program can call, then let it decide on its own which lines are worth a record. parse_line() Move the parsing…

    Fix the code Medium 2 stages functions return dictionaries None
  2. 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
  3. Challenge

    Log analyser

    Turn the launch-day mission log into answers: parse each line into a dict, count the entries per level and per hour, find the first ERROR, then rank the subsystems by how many warnings they raised.

    Write the code Hard 3 stages project logs parsing Counter
  4. Challenge

    Telemetry from CSV

    Point the feed parser from "Parse the whole feed" at telemetry.csv: read it with csv.DictReader, using the header row for the field names, then find the hottest temperature reading, comparing the…

    Write the code Medium 2 stages csv csv.DictReader files open
  5. Challenge

    Survive bad lines

    Extend the feed parser from "Skip blanks and comments": a faulty sensor sends ERR and float() stops the program. Skip lines that fail to convert and count them, then let one try cover short lines too…

    Write the code Medium 2 stages errors try except ValueError
  6. 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
  7. Challenge

    Line to record

    Extend the feed parser so it stores every reading as a dict with time, sensor, value and unit in a list of records, then let other code pick out one sensor's readings by key.

    Write the code Easy 2 stages dictionaries lists parsing records
  8. Challenge

    Skip blanks and comments

    Extend the feed parser so continue skips blank lines and comment lines, then report damaged lines with too few fields instead of crashing, with a count of parsed and damaged lines.

    Write the code Medium 2 stages for loop continue strip startswith
  9. Challenge

    Parse the whole feed

    Go through a block of telemetry line by line with splitlines(), split each line at the commas and print the sensor and value, then unpack the four fields and show the clock time too.

    Write the code Easy 2 stages for loop splitlines split unpacking
  10. Challenge

    Parse a telemetry line

    Split a telemetry reading like 2026-03-14T09:30:05Z,ENG-2,412.5,C into its four fields with split(), print each with a label, then turn the value into a number and convert it to kelvin.

    Write the code Easy 2 stages strings split parsing csv