Results for “strip”

Showing 21–30 of 44

  1. Challenge

    Count warnings

    …counts how many times the text appears. A multi-line string has a new line character, "\n" , between its lines, so there is one line more than there are new lines. Don't be fooled A new entry has come…

    Write the code Medium 3 stages strings count multi-line strings logs
  2. Challenge

    Parse a telemetry line

    …a piece by its index, the same way as a character in a string: fields[0] is the first. Lists get a stage of their own later. The value as a number split() gives text, so "412.5" + 273.15 would stop…

    Write the code Easy 2 stages strings split parsing csv
  3. Challenge

    Daily mission report

    Turn the day's subsystem status into a fixed-width report for the shift handover, with aligned columns and a totals line, then save the same data as a CSV file with csv.DictWriter for the spreadsheet…

    Write the code Medium 2 stages project formatting f-strings alignment
  4. Challenge

    Accept the right files

    Check whether a path starts with telemetry/ and ends with .csv using startswith() and endswith(), see why in isn't enough, then clean up paths with Windows backslashes, capitals and spaces first.

    Write the code Easy 2 stages strings startswith endswith paths
  5. Challenge

    Off-by-one slice

    A slice meant to take the number from the container tag CG-0042 gives -004. Predict it, work out where indexes start and where a slice ends, fix it, then slice a sample label yourself.

    Fix the code Easy 3 stages strings slicing indexing off-by-one
  6. Challenge

    Telemetry report

    Extend the parser from "Parse a telemetry line" to read three readings from a multi-line feed, print each as one row, then turn them into a report with a header and aligned columns.

    Write the code Medium 2 stages strings split slicing f-strings
  7. Challenge

    Decimal comma

    An operator types 42,5 and float() crashes with a ValueError. Predict it, find out why, accept both commas and dots with replace(), then read pressures written like 1 013,25.

    Fix the code Easy 3 stages strings replace float ValueError
  8. Challenge

    Sensor ID parts

    Split a sensor ID like ENG-2 into its subsystem and its unit number as an int, work out the next ID, then handle subsystems with a dash in their name using rsplit().

    Write the code Medium 2 stages strings split rsplit int